Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "XULTreeGridAccessibleWrap.h" |
michael@0 | 7 | |
michael@0 | 8 | #include "nsAccCache.h" |
michael@0 | 9 | #include "nsAccessibilityService.h" |
michael@0 | 10 | #include "nsAccUtils.h" |
michael@0 | 11 | #include "DocAccessible.h" |
michael@0 | 12 | #include "nsEventShell.h" |
michael@0 | 13 | #include "Relation.h" |
michael@0 | 14 | #include "Role.h" |
michael@0 | 15 | #include "States.h" |
michael@0 | 16 | |
michael@0 | 17 | #include "nsIBoxObject.h" |
michael@0 | 18 | #include "nsIMutableArray.h" |
michael@0 | 19 | #include "nsIPersistentProperties2.h" |
michael@0 | 20 | #include "nsITreeSelection.h" |
michael@0 | 21 | #include "nsComponentManagerUtils.h" |
michael@0 | 22 | |
michael@0 | 23 | using namespace mozilla::a11y; |
michael@0 | 24 | |
michael@0 | 25 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 26 | // XULTreeGridAccessible: nsISupports implementation |
michael@0 | 27 | |
michael@0 | 28 | NS_IMPL_ISUPPORTS_INHERITED(XULTreeGridAccessible, |
michael@0 | 29 | XULTreeAccessible, |
michael@0 | 30 | nsIAccessibleTable) |
michael@0 | 31 | |
michael@0 | 32 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 33 | // XULTreeGridAccessible: nsIAccessibleTable implementation |
michael@0 | 34 | |
michael@0 | 35 | uint32_t |
michael@0 | 36 | XULTreeGridAccessible::ColCount() |
michael@0 | 37 | { |
michael@0 | 38 | return nsCoreUtils::GetSensibleColumnCount(mTree); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | uint32_t |
michael@0 | 42 | XULTreeGridAccessible::RowCount() |
michael@0 | 43 | { |
michael@0 | 44 | if (!mTreeView) |
michael@0 | 45 | return 0; |
michael@0 | 46 | |
michael@0 | 47 | int32_t rowCount = 0; |
michael@0 | 48 | mTreeView->GetRowCount(&rowCount); |
michael@0 | 49 | return rowCount >= 0 ? rowCount : 0; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | uint32_t |
michael@0 | 53 | XULTreeGridAccessible::SelectedCellCount() |
michael@0 | 54 | { |
michael@0 | 55 | return SelectedRowCount() * ColCount(); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | uint32_t |
michael@0 | 59 | XULTreeGridAccessible::SelectedColCount() |
michael@0 | 60 | { |
michael@0 | 61 | // If all the row has been selected, then all the columns are selected, |
michael@0 | 62 | // because we can't select a column alone. |
michael@0 | 63 | |
michael@0 | 64 | uint32_t selectedRowCount = SelectedItemCount(); |
michael@0 | 65 | return selectedRowCount > 0 && selectedRowCount == RowCount() ? ColCount() : 0; |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | uint32_t |
michael@0 | 69 | XULTreeGridAccessible::SelectedRowCount() |
michael@0 | 70 | { |
michael@0 | 71 | return SelectedItemCount(); |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | void |
michael@0 | 75 | XULTreeGridAccessible::SelectedCells(nsTArray<Accessible*>* aCells) |
michael@0 | 76 | { |
michael@0 | 77 | uint32_t colCount = ColCount(), rowCount = RowCount(); |
michael@0 | 78 | |
michael@0 | 79 | for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) { |
michael@0 | 80 | if (IsRowSelected(rowIdx)) { |
michael@0 | 81 | for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) { |
michael@0 | 82 | Accessible* cell = CellAt(rowIdx, colIdx); |
michael@0 | 83 | aCells->AppendElement(cell); |
michael@0 | 84 | } |
michael@0 | 85 | } |
michael@0 | 86 | } |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | void |
michael@0 | 90 | XULTreeGridAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells) |
michael@0 | 91 | { |
michael@0 | 92 | uint32_t colCount = ColCount(), rowCount = RowCount(); |
michael@0 | 93 | |
michael@0 | 94 | for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) |
michael@0 | 95 | if (IsRowSelected(rowIdx)) |
michael@0 | 96 | for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) |
michael@0 | 97 | aCells->AppendElement(rowIdx * colCount + colIdx); |
michael@0 | 98 | } |
michael@0 | 99 | |
michael@0 | 100 | void |
michael@0 | 101 | XULTreeGridAccessible::SelectedColIndices(nsTArray<uint32_t>* aCols) |
michael@0 | 102 | { |
michael@0 | 103 | if (RowCount() != SelectedRowCount()) |
michael@0 | 104 | return; |
michael@0 | 105 | |
michael@0 | 106 | uint32_t colCount = ColCount(); |
michael@0 | 107 | aCols->SetCapacity(colCount); |
michael@0 | 108 | for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) |
michael@0 | 109 | aCols->AppendElement(colIdx); |
michael@0 | 110 | } |
michael@0 | 111 | |
michael@0 | 112 | void |
michael@0 | 113 | XULTreeGridAccessible::SelectedRowIndices(nsTArray<uint32_t>* aRows) |
michael@0 | 114 | { |
michael@0 | 115 | uint32_t rowCount = RowCount(); |
michael@0 | 116 | for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) |
michael@0 | 117 | if (IsRowSelected(rowIdx)) |
michael@0 | 118 | aRows->AppendElement(rowIdx); |
michael@0 | 119 | } |
michael@0 | 120 | |
michael@0 | 121 | Accessible* |
michael@0 | 122 | XULTreeGridAccessible::CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) |
michael@0 | 123 | { |
michael@0 | 124 | Accessible* row = GetTreeItemAccessible(aRowIndex); |
michael@0 | 125 | if (!row) |
michael@0 | 126 | return nullptr; |
michael@0 | 127 | |
michael@0 | 128 | nsCOMPtr<nsITreeColumn> column = |
michael@0 | 129 | nsCoreUtils::GetSensibleColumnAt(mTree, aColumnIndex); |
michael@0 | 130 | if (!column) |
michael@0 | 131 | return nullptr; |
michael@0 | 132 | |
michael@0 | 133 | nsRefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(row); |
michael@0 | 134 | if (!rowAcc) |
michael@0 | 135 | return nullptr; |
michael@0 | 136 | |
michael@0 | 137 | return rowAcc->GetCellAccessible(column); |
michael@0 | 138 | } |
michael@0 | 139 | |
michael@0 | 140 | void |
michael@0 | 141 | XULTreeGridAccessible::ColDescription(uint32_t aColIdx, nsString& aDescription) |
michael@0 | 142 | { |
michael@0 | 143 | aDescription.Truncate(); |
michael@0 | 144 | |
michael@0 | 145 | nsCOMPtr<nsIAccessible> treeColumns; |
michael@0 | 146 | Accessible::GetFirstChild(getter_AddRefs(treeColumns)); |
michael@0 | 147 | if (treeColumns) { |
michael@0 | 148 | nsCOMPtr<nsIAccessible> treeColumnItem; |
michael@0 | 149 | treeColumns->GetChildAt(aColIdx, getter_AddRefs(treeColumnItem)); |
michael@0 | 150 | if (treeColumnItem) |
michael@0 | 151 | treeColumnItem->GetName(aDescription); |
michael@0 | 152 | } |
michael@0 | 153 | } |
michael@0 | 154 | |
michael@0 | 155 | bool |
michael@0 | 156 | XULTreeGridAccessible::IsColSelected(uint32_t aColIdx) |
michael@0 | 157 | { |
michael@0 | 158 | // If all the row has been selected, then all the columns are selected. |
michael@0 | 159 | // Because we can't select a column alone. |
michael@0 | 160 | return SelectedItemCount() == RowCount(); |
michael@0 | 161 | } |
michael@0 | 162 | |
michael@0 | 163 | bool |
michael@0 | 164 | XULTreeGridAccessible::IsRowSelected(uint32_t aRowIdx) |
michael@0 | 165 | { |
michael@0 | 166 | if (!mTreeView) |
michael@0 | 167 | return false; |
michael@0 | 168 | |
michael@0 | 169 | nsCOMPtr<nsITreeSelection> selection; |
michael@0 | 170 | nsresult rv = mTreeView->GetSelection(getter_AddRefs(selection)); |
michael@0 | 171 | NS_ENSURE_SUCCESS(rv, false); |
michael@0 | 172 | |
michael@0 | 173 | bool isSelected = false; |
michael@0 | 174 | selection->IsSelected(aRowIdx, &isSelected); |
michael@0 | 175 | return isSelected; |
michael@0 | 176 | } |
michael@0 | 177 | |
michael@0 | 178 | bool |
michael@0 | 179 | XULTreeGridAccessible::IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx) |
michael@0 | 180 | { |
michael@0 | 181 | return IsRowSelected(aRowIdx); |
michael@0 | 182 | } |
michael@0 | 183 | |
michael@0 | 184 | void |
michael@0 | 185 | XULTreeGridAccessible::SelectRow(uint32_t aRowIdx) |
michael@0 | 186 | { |
michael@0 | 187 | if (!mTreeView) |
michael@0 | 188 | return; |
michael@0 | 189 | |
michael@0 | 190 | nsCOMPtr<nsITreeSelection> selection; |
michael@0 | 191 | mTreeView->GetSelection(getter_AddRefs(selection)); |
michael@0 | 192 | NS_ASSERTION(selection, "GetSelection() Shouldn't fail!"); |
michael@0 | 193 | |
michael@0 | 194 | selection->Select(aRowIdx); |
michael@0 | 195 | } |
michael@0 | 196 | |
michael@0 | 197 | void |
michael@0 | 198 | XULTreeGridAccessible::UnselectRow(uint32_t aRowIdx) |
michael@0 | 199 | { |
michael@0 | 200 | if (!mTreeView) |
michael@0 | 201 | return; |
michael@0 | 202 | |
michael@0 | 203 | nsCOMPtr<nsITreeSelection> selection; |
michael@0 | 204 | mTreeView->GetSelection(getter_AddRefs(selection)); |
michael@0 | 205 | |
michael@0 | 206 | if (selection) |
michael@0 | 207 | selection->ClearRange(aRowIdx, aRowIdx); |
michael@0 | 208 | } |
michael@0 | 209 | |
michael@0 | 210 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 211 | // XULTreeGridAccessible: Accessible implementation |
michael@0 | 212 | |
michael@0 | 213 | void |
michael@0 | 214 | XULTreeGridAccessible::Shutdown() |
michael@0 | 215 | { |
michael@0 | 216 | mTable = nullptr; |
michael@0 | 217 | XULTreeAccessible::Shutdown(); |
michael@0 | 218 | } |
michael@0 | 219 | |
michael@0 | 220 | role |
michael@0 | 221 | XULTreeGridAccessible::NativeRole() |
michael@0 | 222 | { |
michael@0 | 223 | nsCOMPtr<nsITreeColumns> treeColumns; |
michael@0 | 224 | mTree->GetColumns(getter_AddRefs(treeColumns)); |
michael@0 | 225 | if (!treeColumns) { |
michael@0 | 226 | NS_ERROR("No treecolumns object for tree!"); |
michael@0 | 227 | return roles::NOTHING; |
michael@0 | 228 | } |
michael@0 | 229 | |
michael@0 | 230 | nsCOMPtr<nsITreeColumn> primaryColumn; |
michael@0 | 231 | treeColumns->GetPrimaryColumn(getter_AddRefs(primaryColumn)); |
michael@0 | 232 | |
michael@0 | 233 | return primaryColumn ? roles::TREE_TABLE : roles::TABLE; |
michael@0 | 234 | } |
michael@0 | 235 | |
michael@0 | 236 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 237 | // XULTreeGridAccessible: XULTreeAccessible implementation |
michael@0 | 238 | |
michael@0 | 239 | already_AddRefed<Accessible> |
michael@0 | 240 | XULTreeGridAccessible::CreateTreeItemAccessible(int32_t aRow) const |
michael@0 | 241 | { |
michael@0 | 242 | nsRefPtr<Accessible> accessible = |
michael@0 | 243 | new XULTreeGridRowAccessible(mContent, mDoc, |
michael@0 | 244 | const_cast<XULTreeGridAccessible*>(this), |
michael@0 | 245 | mTree, mTreeView, aRow); |
michael@0 | 246 | |
michael@0 | 247 | return accessible.forget(); |
michael@0 | 248 | } |
michael@0 | 249 | |
michael@0 | 250 | |
michael@0 | 251 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 252 | // XULTreeGridRowAccessible |
michael@0 | 253 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 254 | |
michael@0 | 255 | XULTreeGridRowAccessible:: |
michael@0 | 256 | XULTreeGridRowAccessible(nsIContent* aContent, DocAccessible* aDoc, |
michael@0 | 257 | Accessible* aTreeAcc, nsITreeBoxObject* aTree, |
michael@0 | 258 | nsITreeView* aTreeView, int32_t aRow) : |
michael@0 | 259 | XULTreeItemAccessibleBase(aContent, aDoc, aTreeAcc, aTree, aTreeView, aRow), |
michael@0 | 260 | mAccessibleCache(kDefaultTreeCacheSize) |
michael@0 | 261 | { |
michael@0 | 262 | mGenericTypes |= eTableRow; |
michael@0 | 263 | } |
michael@0 | 264 | |
michael@0 | 265 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 266 | // XULTreeGridRowAccessible: nsISupports and cycle collection implementation |
michael@0 | 267 | |
michael@0 | 268 | NS_IMPL_CYCLE_COLLECTION_INHERITED(XULTreeGridRowAccessible, |
michael@0 | 269 | XULTreeItemAccessibleBase, |
michael@0 | 270 | mAccessibleCache) |
michael@0 | 271 | |
michael@0 | 272 | NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XULTreeGridRowAccessible) |
michael@0 | 273 | NS_INTERFACE_MAP_END_INHERITING(XULTreeItemAccessibleBase) |
michael@0 | 274 | |
michael@0 | 275 | NS_IMPL_ADDREF_INHERITED(XULTreeGridRowAccessible, |
michael@0 | 276 | XULTreeItemAccessibleBase) |
michael@0 | 277 | NS_IMPL_RELEASE_INHERITED(XULTreeGridRowAccessible, |
michael@0 | 278 | XULTreeItemAccessibleBase) |
michael@0 | 279 | |
michael@0 | 280 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 281 | // XULTreeGridRowAccessible: Accessible implementation |
michael@0 | 282 | |
michael@0 | 283 | void |
michael@0 | 284 | XULTreeGridRowAccessible::Shutdown() |
michael@0 | 285 | { |
michael@0 | 286 | ClearCache(mAccessibleCache); |
michael@0 | 287 | XULTreeItemAccessibleBase::Shutdown(); |
michael@0 | 288 | } |
michael@0 | 289 | |
michael@0 | 290 | role |
michael@0 | 291 | XULTreeGridRowAccessible::NativeRole() |
michael@0 | 292 | { |
michael@0 | 293 | return roles::ROW; |
michael@0 | 294 | } |
michael@0 | 295 | |
michael@0 | 296 | ENameValueFlag |
michael@0 | 297 | XULTreeGridRowAccessible::Name(nsString& aName) |
michael@0 | 298 | { |
michael@0 | 299 | aName.Truncate(); |
michael@0 | 300 | |
michael@0 | 301 | // XXX: the row name sholdn't be a concatenation of cell names (bug 664384). |
michael@0 | 302 | nsCOMPtr<nsITreeColumn> column = nsCoreUtils::GetFirstSensibleColumn(mTree); |
michael@0 | 303 | while (column) { |
michael@0 | 304 | if (!aName.IsEmpty()) |
michael@0 | 305 | aName.AppendLiteral(" "); |
michael@0 | 306 | |
michael@0 | 307 | nsAutoString cellName; |
michael@0 | 308 | GetCellName(column, cellName); |
michael@0 | 309 | aName.Append(cellName); |
michael@0 | 310 | |
michael@0 | 311 | column = nsCoreUtils::GetNextSensibleColumn(column); |
michael@0 | 312 | } |
michael@0 | 313 | |
michael@0 | 314 | return eNameOK; |
michael@0 | 315 | } |
michael@0 | 316 | |
michael@0 | 317 | Accessible* |
michael@0 | 318 | XULTreeGridRowAccessible::ChildAtPoint(int32_t aX, int32_t aY, |
michael@0 | 319 | EWhichChildAtPoint aWhichChild) |
michael@0 | 320 | { |
michael@0 | 321 | nsIFrame *frame = GetFrame(); |
michael@0 | 322 | if (!frame) |
michael@0 | 323 | return nullptr; |
michael@0 | 324 | |
michael@0 | 325 | nsPresContext *presContext = frame->PresContext(); |
michael@0 | 326 | nsIPresShell* presShell = presContext->PresShell(); |
michael@0 | 327 | |
michael@0 | 328 | nsIFrame *rootFrame = presShell->GetRootFrame(); |
michael@0 | 329 | NS_ENSURE_TRUE(rootFrame, nullptr); |
michael@0 | 330 | |
michael@0 | 331 | nsIntRect rootRect = rootFrame->GetScreenRect(); |
michael@0 | 332 | |
michael@0 | 333 | int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.x; |
michael@0 | 334 | int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.y; |
michael@0 | 335 | |
michael@0 | 336 | int32_t row = -1; |
michael@0 | 337 | nsCOMPtr<nsITreeColumn> column; |
michael@0 | 338 | nsAutoCString childEltUnused; |
michael@0 | 339 | mTree->GetCellAt(clientX, clientY, &row, getter_AddRefs(column), |
michael@0 | 340 | childEltUnused); |
michael@0 | 341 | |
michael@0 | 342 | // Return if we failed to find tree cell in the row for the given point. |
michael@0 | 343 | if (row != mRow || !column) |
michael@0 | 344 | return nullptr; |
michael@0 | 345 | |
michael@0 | 346 | return GetCellAccessible(column); |
michael@0 | 347 | } |
michael@0 | 348 | |
michael@0 | 349 | Accessible* |
michael@0 | 350 | XULTreeGridRowAccessible::GetChildAt(uint32_t aIndex) const |
michael@0 | 351 | { |
michael@0 | 352 | if (IsDefunct()) |
michael@0 | 353 | return nullptr; |
michael@0 | 354 | |
michael@0 | 355 | nsCOMPtr<nsITreeColumn> column = |
michael@0 | 356 | nsCoreUtils::GetSensibleColumnAt(mTree, aIndex); |
michael@0 | 357 | if (!column) |
michael@0 | 358 | return nullptr; |
michael@0 | 359 | |
michael@0 | 360 | return GetCellAccessible(column); |
michael@0 | 361 | } |
michael@0 | 362 | |
michael@0 | 363 | uint32_t |
michael@0 | 364 | XULTreeGridRowAccessible::ChildCount() const |
michael@0 | 365 | { |
michael@0 | 366 | return nsCoreUtils::GetSensibleColumnCount(mTree); |
michael@0 | 367 | } |
michael@0 | 368 | |
michael@0 | 369 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 370 | // XULTreeGridRowAccessible: XULTreeItemAccessibleBase implementation |
michael@0 | 371 | |
michael@0 | 372 | Accessible* |
michael@0 | 373 | XULTreeGridRowAccessible::GetCellAccessible(nsITreeColumn* aColumn) const |
michael@0 | 374 | { |
michael@0 | 375 | NS_PRECONDITION(aColumn, "No tree column!"); |
michael@0 | 376 | |
michael@0 | 377 | void* key = static_cast<void*>(aColumn); |
michael@0 | 378 | Accessible* cachedCell = mAccessibleCache.GetWeak(key); |
michael@0 | 379 | if (cachedCell) |
michael@0 | 380 | return cachedCell; |
michael@0 | 381 | |
michael@0 | 382 | nsRefPtr<Accessible> cell = |
michael@0 | 383 | new XULTreeGridCellAccessibleWrap(mContent, mDoc, |
michael@0 | 384 | const_cast<XULTreeGridRowAccessible*>(this), |
michael@0 | 385 | mTree, mTreeView, mRow, aColumn); |
michael@0 | 386 | mAccessibleCache.Put(key, cell); |
michael@0 | 387 | Document()->BindToDocument(cell, nullptr); |
michael@0 | 388 | return cell; |
michael@0 | 389 | } |
michael@0 | 390 | |
michael@0 | 391 | void |
michael@0 | 392 | XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx, |
michael@0 | 393 | int32_t aEndColIdx) |
michael@0 | 394 | { |
michael@0 | 395 | nsCOMPtr<nsITreeColumns> treeColumns; |
michael@0 | 396 | mTree->GetColumns(getter_AddRefs(treeColumns)); |
michael@0 | 397 | if (!treeColumns) |
michael@0 | 398 | return; |
michael@0 | 399 | |
michael@0 | 400 | bool nameChanged = false; |
michael@0 | 401 | for (int32_t colIdx = aStartColIdx; colIdx <= aEndColIdx; ++colIdx) { |
michael@0 | 402 | nsCOMPtr<nsITreeColumn> column; |
michael@0 | 403 | treeColumns->GetColumnAt(colIdx, getter_AddRefs(column)); |
michael@0 | 404 | if (column && !nsCoreUtils::IsColumnHidden(column)) { |
michael@0 | 405 | Accessible* cellAccessible = GetCellAccessible(column); |
michael@0 | 406 | if (cellAccessible) { |
michael@0 | 407 | nsRefPtr<XULTreeGridCellAccessible> cellAcc = do_QueryObject(cellAccessible); |
michael@0 | 408 | |
michael@0 | 409 | nameChanged |= cellAcc->CellInvalidated(); |
michael@0 | 410 | } |
michael@0 | 411 | } |
michael@0 | 412 | } |
michael@0 | 413 | |
michael@0 | 414 | if (nameChanged) |
michael@0 | 415 | nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this); |
michael@0 | 416 | |
michael@0 | 417 | } |
michael@0 | 418 | |
michael@0 | 419 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 420 | // XULTreeGridRowAccessible: Accessible protected implementation |
michael@0 | 421 | |
michael@0 | 422 | void |
michael@0 | 423 | XULTreeGridRowAccessible::CacheChildren() |
michael@0 | 424 | { |
michael@0 | 425 | } |
michael@0 | 426 | |
michael@0 | 427 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 428 | // XULTreeGridCellAccessible |
michael@0 | 429 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 430 | |
michael@0 | 431 | XULTreeGridCellAccessible:: |
michael@0 | 432 | XULTreeGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc, |
michael@0 | 433 | XULTreeGridRowAccessible* aRowAcc, |
michael@0 | 434 | nsITreeBoxObject* aTree, nsITreeView* aTreeView, |
michael@0 | 435 | int32_t aRow, nsITreeColumn* aColumn) : |
michael@0 | 436 | LeafAccessible(aContent, aDoc), xpcAccessibleTableCell(this), mTree(aTree), |
michael@0 | 437 | mTreeView(aTreeView), mRow(aRow), mColumn(aColumn) |
michael@0 | 438 | { |
michael@0 | 439 | mParent = aRowAcc; |
michael@0 | 440 | mStateFlags |= eSharedNode; |
michael@0 | 441 | mGenericTypes |= eTableCell; |
michael@0 | 442 | |
michael@0 | 443 | NS_ASSERTION(mTreeView, "mTreeView is null"); |
michael@0 | 444 | |
michael@0 | 445 | int16_t type = -1; |
michael@0 | 446 | mColumn->GetType(&type); |
michael@0 | 447 | if (type == nsITreeColumn::TYPE_CHECKBOX) |
michael@0 | 448 | mTreeView->GetCellValue(mRow, mColumn, mCachedTextEquiv); |
michael@0 | 449 | else |
michael@0 | 450 | mTreeView->GetCellText(mRow, mColumn, mCachedTextEquiv); |
michael@0 | 451 | } |
michael@0 | 452 | |
michael@0 | 453 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 454 | // XULTreeGridCellAccessible: nsISupports implementation |
michael@0 | 455 | |
michael@0 | 456 | NS_IMPL_CYCLE_COLLECTION_INHERITED(XULTreeGridCellAccessible, LeafAccessible, |
michael@0 | 457 | mTree, mColumn) |
michael@0 | 458 | |
michael@0 | 459 | NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(XULTreeGridCellAccessible) |
michael@0 | 460 | NS_INTERFACE_TABLE_INHERITED(XULTreeGridCellAccessible, |
michael@0 | 461 | nsIAccessibleTableCell, |
michael@0 | 462 | XULTreeGridCellAccessible) |
michael@0 | 463 | NS_INTERFACE_TABLE_TAIL_INHERITING(LeafAccessible) |
michael@0 | 464 | NS_IMPL_ADDREF_INHERITED(XULTreeGridCellAccessible, LeafAccessible) |
michael@0 | 465 | NS_IMPL_RELEASE_INHERITED(XULTreeGridCellAccessible, LeafAccessible) |
michael@0 | 466 | |
michael@0 | 467 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 468 | // XULTreeGridCellAccessible: nsIAccessible implementation |
michael@0 | 469 | |
michael@0 | 470 | void |
michael@0 | 471 | XULTreeGridCellAccessible::Shutdown() |
michael@0 | 472 | { |
michael@0 | 473 | mTableCell = nullptr; |
michael@0 | 474 | LeafAccessible::Shutdown(); |
michael@0 | 475 | } |
michael@0 | 476 | |
michael@0 | 477 | Accessible* |
michael@0 | 478 | XULTreeGridCellAccessible::FocusedChild() |
michael@0 | 479 | { |
michael@0 | 480 | return nullptr; |
michael@0 | 481 | } |
michael@0 | 482 | |
michael@0 | 483 | ENameValueFlag |
michael@0 | 484 | XULTreeGridCellAccessible::Name(nsString& aName) |
michael@0 | 485 | { |
michael@0 | 486 | aName.Truncate(); |
michael@0 | 487 | |
michael@0 | 488 | if (!mTreeView) |
michael@0 | 489 | return eNameOK; |
michael@0 | 490 | |
michael@0 | 491 | mTreeView->GetCellText(mRow, mColumn, aName); |
michael@0 | 492 | |
michael@0 | 493 | // If there is still no name try the cell value: |
michael@0 | 494 | // This is for graphical cells. We need tree/table view implementors to implement |
michael@0 | 495 | // FooView::GetCellValue to return a meaningful string for cases where there is |
michael@0 | 496 | // something shown in the cell (non-text) such as a star icon; in which case |
michael@0 | 497 | // GetCellValue for that cell would return "starred" or "flagged" for example. |
michael@0 | 498 | if (aName.IsEmpty()) |
michael@0 | 499 | mTreeView->GetCellValue(mRow, mColumn, aName); |
michael@0 | 500 | |
michael@0 | 501 | return eNameOK; |
michael@0 | 502 | } |
michael@0 | 503 | |
michael@0 | 504 | NS_IMETHODIMP |
michael@0 | 505 | XULTreeGridCellAccessible::GetBounds(int32_t* aX, int32_t* aY, |
michael@0 | 506 | int32_t* aWidth, int32_t* aHeight) |
michael@0 | 507 | { |
michael@0 | 508 | NS_ENSURE_ARG_POINTER(aX); |
michael@0 | 509 | *aX = 0; |
michael@0 | 510 | NS_ENSURE_ARG_POINTER(aY); |
michael@0 | 511 | *aY = 0; |
michael@0 | 512 | NS_ENSURE_ARG_POINTER(aWidth); |
michael@0 | 513 | *aWidth = 0; |
michael@0 | 514 | NS_ENSURE_ARG_POINTER(aHeight); |
michael@0 | 515 | *aHeight = 0; |
michael@0 | 516 | |
michael@0 | 517 | if (IsDefunct()) |
michael@0 | 518 | return NS_ERROR_FAILURE; |
michael@0 | 519 | |
michael@0 | 520 | // Get bounds for tree cell and add x and y of treechildren element to |
michael@0 | 521 | // x and y of the cell. |
michael@0 | 522 | nsCOMPtr<nsIBoxObject> boxObj = nsCoreUtils::GetTreeBodyBoxObject(mTree); |
michael@0 | 523 | NS_ENSURE_STATE(boxObj); |
michael@0 | 524 | |
michael@0 | 525 | int32_t x = 0, y = 0, width = 0, height = 0; |
michael@0 | 526 | nsresult rv = mTree->GetCoordsForCellItem(mRow, mColumn, |
michael@0 | 527 | NS_LITERAL_CSTRING("cell"), |
michael@0 | 528 | &x, &y, &width, &height); |
michael@0 | 529 | NS_ENSURE_SUCCESS(rv, rv); |
michael@0 | 530 | |
michael@0 | 531 | int32_t tcX = 0, tcY = 0; |
michael@0 | 532 | boxObj->GetScreenX(&tcX); |
michael@0 | 533 | boxObj->GetScreenY(&tcY); |
michael@0 | 534 | x += tcX; |
michael@0 | 535 | y += tcY; |
michael@0 | 536 | |
michael@0 | 537 | nsPresContext* presContext = mDoc->PresContext(); |
michael@0 | 538 | *aX = presContext->CSSPixelsToDevPixels(x); |
michael@0 | 539 | *aY = presContext->CSSPixelsToDevPixels(y); |
michael@0 | 540 | *aWidth = presContext->CSSPixelsToDevPixels(width); |
michael@0 | 541 | *aHeight = presContext->CSSPixelsToDevPixels(height); |
michael@0 | 542 | |
michael@0 | 543 | return NS_OK; |
michael@0 | 544 | } |
michael@0 | 545 | |
michael@0 | 546 | uint8_t |
michael@0 | 547 | XULTreeGridCellAccessible::ActionCount() |
michael@0 | 548 | { |
michael@0 | 549 | bool isCycler = false; |
michael@0 | 550 | mColumn->GetCycler(&isCycler); |
michael@0 | 551 | if (isCycler) |
michael@0 | 552 | return 1; |
michael@0 | 553 | |
michael@0 | 554 | int16_t type; |
michael@0 | 555 | mColumn->GetType(&type); |
michael@0 | 556 | if (type == nsITreeColumn::TYPE_CHECKBOX && IsEditable()) |
michael@0 | 557 | return 1; |
michael@0 | 558 | |
michael@0 | 559 | return 0; |
michael@0 | 560 | } |
michael@0 | 561 | |
michael@0 | 562 | NS_IMETHODIMP |
michael@0 | 563 | XULTreeGridCellAccessible::GetActionName(uint8_t aIndex, nsAString& aName) |
michael@0 | 564 | { |
michael@0 | 565 | aName.Truncate(); |
michael@0 | 566 | |
michael@0 | 567 | if (aIndex != eAction_Click) |
michael@0 | 568 | return NS_ERROR_INVALID_ARG; |
michael@0 | 569 | |
michael@0 | 570 | if (IsDefunct() || !mTreeView) |
michael@0 | 571 | return NS_ERROR_FAILURE; |
michael@0 | 572 | |
michael@0 | 573 | bool isCycler = false; |
michael@0 | 574 | mColumn->GetCycler(&isCycler); |
michael@0 | 575 | if (isCycler) { |
michael@0 | 576 | aName.AssignLiteral("cycle"); |
michael@0 | 577 | return NS_OK; |
michael@0 | 578 | } |
michael@0 | 579 | |
michael@0 | 580 | int16_t type; |
michael@0 | 581 | mColumn->GetType(&type); |
michael@0 | 582 | if (type == nsITreeColumn::TYPE_CHECKBOX && IsEditable()) { |
michael@0 | 583 | nsAutoString value; |
michael@0 | 584 | mTreeView->GetCellValue(mRow, mColumn, value); |
michael@0 | 585 | if (value.EqualsLiteral("true")) |
michael@0 | 586 | aName.AssignLiteral("uncheck"); |
michael@0 | 587 | else |
michael@0 | 588 | aName.AssignLiteral("check"); |
michael@0 | 589 | |
michael@0 | 590 | return NS_OK; |
michael@0 | 591 | } |
michael@0 | 592 | |
michael@0 | 593 | return NS_ERROR_INVALID_ARG; |
michael@0 | 594 | } |
michael@0 | 595 | |
michael@0 | 596 | NS_IMETHODIMP |
michael@0 | 597 | XULTreeGridCellAccessible::DoAction(uint8_t aIndex) |
michael@0 | 598 | { |
michael@0 | 599 | if (aIndex != eAction_Click) |
michael@0 | 600 | return NS_ERROR_INVALID_ARG; |
michael@0 | 601 | |
michael@0 | 602 | if (IsDefunct()) |
michael@0 | 603 | return NS_ERROR_FAILURE; |
michael@0 | 604 | |
michael@0 | 605 | bool isCycler = false; |
michael@0 | 606 | mColumn->GetCycler(&isCycler); |
michael@0 | 607 | if (isCycler) { |
michael@0 | 608 | DoCommand(); |
michael@0 | 609 | return NS_OK; |
michael@0 | 610 | } |
michael@0 | 611 | |
michael@0 | 612 | int16_t type; |
michael@0 | 613 | mColumn->GetType(&type); |
michael@0 | 614 | if (type == nsITreeColumn::TYPE_CHECKBOX && IsEditable()) { |
michael@0 | 615 | DoCommand(); |
michael@0 | 616 | return NS_OK; |
michael@0 | 617 | } |
michael@0 | 618 | |
michael@0 | 619 | return NS_ERROR_INVALID_ARG; |
michael@0 | 620 | } |
michael@0 | 621 | |
michael@0 | 622 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 623 | // XULTreeGridCellAccessible: nsIAccessibleTableCell implementation |
michael@0 | 624 | |
michael@0 | 625 | TableAccessible* |
michael@0 | 626 | XULTreeGridCellAccessible::Table() const |
michael@0 | 627 | { |
michael@0 | 628 | Accessible* grandParent = mParent->Parent(); |
michael@0 | 629 | if (grandParent) |
michael@0 | 630 | return grandParent->AsTable(); |
michael@0 | 631 | |
michael@0 | 632 | return nullptr; |
michael@0 | 633 | } |
michael@0 | 634 | |
michael@0 | 635 | uint32_t |
michael@0 | 636 | XULTreeGridCellAccessible::ColIdx() const |
michael@0 | 637 | { |
michael@0 | 638 | uint32_t colIdx = 0; |
michael@0 | 639 | nsCOMPtr<nsITreeColumn> column = mColumn; |
michael@0 | 640 | while ((column = nsCoreUtils::GetPreviousSensibleColumn(column))) |
michael@0 | 641 | colIdx++; |
michael@0 | 642 | |
michael@0 | 643 | return colIdx; |
michael@0 | 644 | } |
michael@0 | 645 | |
michael@0 | 646 | uint32_t |
michael@0 | 647 | XULTreeGridCellAccessible::RowIdx() const |
michael@0 | 648 | { |
michael@0 | 649 | return mRow; |
michael@0 | 650 | } |
michael@0 | 651 | |
michael@0 | 652 | void |
michael@0 | 653 | XULTreeGridCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aHeaderCells) |
michael@0 | 654 | { |
michael@0 | 655 | nsCOMPtr<nsIDOMElement> columnElm; |
michael@0 | 656 | mColumn->GetElement(getter_AddRefs(columnElm)); |
michael@0 | 657 | |
michael@0 | 658 | nsCOMPtr<nsIContent> columnContent(do_QueryInterface(columnElm)); |
michael@0 | 659 | Accessible* headerCell = mDoc->GetAccessible(columnContent); |
michael@0 | 660 | if (headerCell) |
michael@0 | 661 | aHeaderCells->AppendElement(headerCell); |
michael@0 | 662 | } |
michael@0 | 663 | |
michael@0 | 664 | bool |
michael@0 | 665 | XULTreeGridCellAccessible::Selected() |
michael@0 | 666 | { |
michael@0 | 667 | nsCOMPtr<nsITreeSelection> selection; |
michael@0 | 668 | nsresult rv = mTreeView->GetSelection(getter_AddRefs(selection)); |
michael@0 | 669 | NS_ENSURE_SUCCESS(rv, false); |
michael@0 | 670 | |
michael@0 | 671 | bool selected = false; |
michael@0 | 672 | selection->IsSelected(mRow, &selected); |
michael@0 | 673 | return selected; |
michael@0 | 674 | } |
michael@0 | 675 | |
michael@0 | 676 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 677 | // XULTreeGridCellAccessible: Accessible public implementation |
michael@0 | 678 | |
michael@0 | 679 | already_AddRefed<nsIPersistentProperties> |
michael@0 | 680 | XULTreeGridCellAccessible::NativeAttributes() |
michael@0 | 681 | { |
michael@0 | 682 | nsCOMPtr<nsIPersistentProperties> attributes = |
michael@0 | 683 | do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID); |
michael@0 | 684 | |
michael@0 | 685 | // "table-cell-index" attribute |
michael@0 | 686 | TableAccessible* table = Table(); |
michael@0 | 687 | if (!table) |
michael@0 | 688 | return attributes.forget(); |
michael@0 | 689 | |
michael@0 | 690 | nsAutoString stringIdx; |
michael@0 | 691 | stringIdx.AppendInt(table->CellIndexAt(mRow, ColIdx())); |
michael@0 | 692 | nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tableCellIndex, stringIdx); |
michael@0 | 693 | |
michael@0 | 694 | // "cycles" attribute |
michael@0 | 695 | bool isCycler = false; |
michael@0 | 696 | nsresult rv = mColumn->GetCycler(&isCycler); |
michael@0 | 697 | if (NS_SUCCEEDED(rv) && isCycler) |
michael@0 | 698 | nsAccUtils::SetAccAttr(attributes, nsGkAtoms::cycles, |
michael@0 | 699 | NS_LITERAL_STRING("true")); |
michael@0 | 700 | |
michael@0 | 701 | return attributes.forget(); |
michael@0 | 702 | } |
michael@0 | 703 | |
michael@0 | 704 | role |
michael@0 | 705 | XULTreeGridCellAccessible::NativeRole() |
michael@0 | 706 | { |
michael@0 | 707 | return roles::GRID_CELL; |
michael@0 | 708 | } |
michael@0 | 709 | |
michael@0 | 710 | uint64_t |
michael@0 | 711 | XULTreeGridCellAccessible::NativeState() |
michael@0 | 712 | { |
michael@0 | 713 | if (!mTreeView) |
michael@0 | 714 | return states::DEFUNCT; |
michael@0 | 715 | |
michael@0 | 716 | // selectable/selected state |
michael@0 | 717 | uint64_t states = states::SELECTABLE; // keep in sync with NativeInteractiveState |
michael@0 | 718 | |
michael@0 | 719 | nsCOMPtr<nsITreeSelection> selection; |
michael@0 | 720 | mTreeView->GetSelection(getter_AddRefs(selection)); |
michael@0 | 721 | if (selection) { |
michael@0 | 722 | bool isSelected = false; |
michael@0 | 723 | selection->IsSelected(mRow, &isSelected); |
michael@0 | 724 | if (isSelected) |
michael@0 | 725 | states |= states::SELECTED; |
michael@0 | 726 | } |
michael@0 | 727 | |
michael@0 | 728 | // checked state |
michael@0 | 729 | int16_t type; |
michael@0 | 730 | mColumn->GetType(&type); |
michael@0 | 731 | if (type == nsITreeColumn::TYPE_CHECKBOX) { |
michael@0 | 732 | states |= states::CHECKABLE; |
michael@0 | 733 | nsAutoString checked; |
michael@0 | 734 | mTreeView->GetCellValue(mRow, mColumn, checked); |
michael@0 | 735 | if (checked.EqualsIgnoreCase("true")) |
michael@0 | 736 | states |= states::CHECKED; |
michael@0 | 737 | } |
michael@0 | 738 | |
michael@0 | 739 | return states; |
michael@0 | 740 | } |
michael@0 | 741 | |
michael@0 | 742 | uint64_t |
michael@0 | 743 | XULTreeGridCellAccessible::NativeInteractiveState() const |
michael@0 | 744 | { |
michael@0 | 745 | return states::SELECTABLE; |
michael@0 | 746 | } |
michael@0 | 747 | |
michael@0 | 748 | int32_t |
michael@0 | 749 | XULTreeGridCellAccessible::IndexInParent() const |
michael@0 | 750 | { |
michael@0 | 751 | return ColIdx(); |
michael@0 | 752 | } |
michael@0 | 753 | |
michael@0 | 754 | Relation |
michael@0 | 755 | XULTreeGridCellAccessible::RelationByType(RelationType aType) |
michael@0 | 756 | { |
michael@0 | 757 | return Relation(); |
michael@0 | 758 | } |
michael@0 | 759 | |
michael@0 | 760 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 761 | // XULTreeGridCellAccessible: public implementation |
michael@0 | 762 | |
michael@0 | 763 | bool |
michael@0 | 764 | XULTreeGridCellAccessible::CellInvalidated() |
michael@0 | 765 | { |
michael@0 | 766 | |
michael@0 | 767 | nsAutoString textEquiv; |
michael@0 | 768 | |
michael@0 | 769 | int16_t type; |
michael@0 | 770 | mColumn->GetType(&type); |
michael@0 | 771 | if (type == nsITreeColumn::TYPE_CHECKBOX) { |
michael@0 | 772 | mTreeView->GetCellValue(mRow, mColumn, textEquiv); |
michael@0 | 773 | if (mCachedTextEquiv != textEquiv) { |
michael@0 | 774 | bool isEnabled = textEquiv.EqualsLiteral("true"); |
michael@0 | 775 | nsRefPtr<AccEvent> accEvent = |
michael@0 | 776 | new AccStateChangeEvent(this, states::CHECKED, isEnabled); |
michael@0 | 777 | nsEventShell::FireEvent(accEvent); |
michael@0 | 778 | |
michael@0 | 779 | mCachedTextEquiv = textEquiv; |
michael@0 | 780 | return true; |
michael@0 | 781 | } |
michael@0 | 782 | |
michael@0 | 783 | return false; |
michael@0 | 784 | } |
michael@0 | 785 | |
michael@0 | 786 | mTreeView->GetCellText(mRow, mColumn, textEquiv); |
michael@0 | 787 | if (mCachedTextEquiv != textEquiv) { |
michael@0 | 788 | nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this); |
michael@0 | 789 | mCachedTextEquiv = textEquiv; |
michael@0 | 790 | return true; |
michael@0 | 791 | } |
michael@0 | 792 | |
michael@0 | 793 | return false; |
michael@0 | 794 | } |
michael@0 | 795 | |
michael@0 | 796 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 797 | // XULTreeGridCellAccessible: Accessible protected implementation |
michael@0 | 798 | |
michael@0 | 799 | Accessible* |
michael@0 | 800 | XULTreeGridCellAccessible::GetSiblingAtOffset(int32_t aOffset, |
michael@0 | 801 | nsresult* aError) const |
michael@0 | 802 | { |
michael@0 | 803 | if (aError) |
michael@0 | 804 | *aError = NS_OK; // fail peacefully |
michael@0 | 805 | |
michael@0 | 806 | nsCOMPtr<nsITreeColumn> columnAtOffset(mColumn), column; |
michael@0 | 807 | if (aOffset < 0) { |
michael@0 | 808 | for (int32_t index = aOffset; index < 0 && columnAtOffset; index++) { |
michael@0 | 809 | column = nsCoreUtils::GetPreviousSensibleColumn(columnAtOffset); |
michael@0 | 810 | column.swap(columnAtOffset); |
michael@0 | 811 | } |
michael@0 | 812 | } else { |
michael@0 | 813 | for (int32_t index = aOffset; index > 0 && columnAtOffset; index--) { |
michael@0 | 814 | column = nsCoreUtils::GetNextSensibleColumn(columnAtOffset); |
michael@0 | 815 | column.swap(columnAtOffset); |
michael@0 | 816 | } |
michael@0 | 817 | } |
michael@0 | 818 | |
michael@0 | 819 | if (!columnAtOffset) |
michael@0 | 820 | return nullptr; |
michael@0 | 821 | |
michael@0 | 822 | nsRefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(Parent()); |
michael@0 | 823 | return rowAcc->GetCellAccessible(columnAtOffset); |
michael@0 | 824 | } |
michael@0 | 825 | |
michael@0 | 826 | void |
michael@0 | 827 | XULTreeGridCellAccessible::DispatchClickEvent(nsIContent* aContent, |
michael@0 | 828 | uint32_t aActionIndex) |
michael@0 | 829 | { |
michael@0 | 830 | if (IsDefunct()) |
michael@0 | 831 | return; |
michael@0 | 832 | |
michael@0 | 833 | nsCoreUtils::DispatchClickEvent(mTree, mRow, mColumn); |
michael@0 | 834 | } |
michael@0 | 835 | |
michael@0 | 836 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 837 | // XULTreeGridCellAccessible: protected implementation |
michael@0 | 838 | |
michael@0 | 839 | bool |
michael@0 | 840 | XULTreeGridCellAccessible::IsEditable() const |
michael@0 | 841 | { |
michael@0 | 842 | |
michael@0 | 843 | // XXX: logic corresponds to tree.xml, it's preferable to have interface |
michael@0 | 844 | // method to check it. |
michael@0 | 845 | bool isEditable = false; |
michael@0 | 846 | nsresult rv = mTreeView->IsEditable(mRow, mColumn, &isEditable); |
michael@0 | 847 | if (NS_FAILED(rv) || !isEditable) |
michael@0 | 848 | return false; |
michael@0 | 849 | |
michael@0 | 850 | nsCOMPtr<nsIDOMElement> columnElm; |
michael@0 | 851 | mColumn->GetElement(getter_AddRefs(columnElm)); |
michael@0 | 852 | if (!columnElm) |
michael@0 | 853 | return false; |
michael@0 | 854 | |
michael@0 | 855 | nsCOMPtr<nsIContent> columnContent(do_QueryInterface(columnElm)); |
michael@0 | 856 | if (!columnContent->AttrValueIs(kNameSpaceID_None, |
michael@0 | 857 | nsGkAtoms::editable, |
michael@0 | 858 | nsGkAtoms::_true, |
michael@0 | 859 | eCaseMatters)) |
michael@0 | 860 | return false; |
michael@0 | 861 | |
michael@0 | 862 | return mContent->AttrValueIs(kNameSpaceID_None, |
michael@0 | 863 | nsGkAtoms::editable, |
michael@0 | 864 | nsGkAtoms::_true, eCaseMatters); |
michael@0 | 865 | } |