Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 if (!m_layoutObject) 1089 if (!m_layoutObject)
1090 return String(); 1090 return String();
1091 1091
1092 LayoutBoxModelObject* cssBox = getLayoutBoxModelObject(); 1092 LayoutBoxModelObject* cssBox = getLayoutBoxModelObject();
1093 1093
1094 if (cssBox && cssBox->isMenuList()) { 1094 if (cssBox && cssBox->isMenuList()) {
1095 // LayoutMenuList will go straight to the text() of its selected item. 1095 // LayoutMenuList will go straight to the text() of its selected item.
1096 // This has to be overridden in the case where the selected item has an ARIA label. 1096 // This has to be overridden in the case where the selected item has an ARIA label.
1097 HTMLSelectElement* selectElement = toHTMLSelectElement(m_layoutObject->n ode()); 1097 HTMLSelectElement* selectElement = toHTMLSelectElement(m_layoutObject->n ode());
1098 int selectedIndex = selectElement->selectedIndex(); 1098 int selectedIndex = selectElement->selectedIndex();
1099 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement->listItems(); 1099 const HeapVector<Member<HTMLElement>>& listItems = selectElement->listIt ems();
1100 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) { 1100 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) {
1101 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr); 1101 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr);
1102 if (!overriddenDescription.isNull()) 1102 if (!overriddenDescription.isNull())
1103 return overriddenDescription; 1103 return overriddenDescription;
1104 } 1104 }
1105 return toLayoutMenuList(m_layoutObject)->text(); 1105 return toLayoutMenuList(m_layoutObject)->text();
1106 } 1106 }
1107 1107
1108 if (isWebArea()) { 1108 if (isWebArea()) {
1109 // FIXME: Why would a layoutObject exist when the Document isn't attache d to a frame? 1109 // FIXME: Why would a layoutObject exist when the Document isn't attache d to a frame?
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 AXObject::AXRange AXLayoutObject::selectionUnderObject() const 1844 AXObject::AXRange AXLayoutObject::selectionUnderObject() const
1845 { 1845 {
1846 AXRange textSelection = textControlSelection(); 1846 AXRange textSelection = textControlSelection();
1847 if (textSelection.isValid()) 1847 if (textSelection.isValid())
1848 return textSelection; 1848 return textSelection;
1849 1849
1850 if (!getNode() || !getLayoutObject()->frame()) 1850 if (!getNode() || !getLayoutObject()->frame())
1851 return AXRange(); 1851 return AXRange();
1852 1852
1853 VisibleSelection selection = getLayoutObject()->frame()->selection().selecti on(); 1853 VisibleSelection selection = getLayoutObject()->frame()->selection().selecti on();
1854 RefPtrWillBeRawPtr<Range> selectionRange = firstRangeOf(selection); 1854 RawPtr<Range> selectionRange = firstRangeOf(selection);
1855 ContainerNode* parentNode = getNode()->parentNode(); 1855 ContainerNode* parentNode = getNode()->parentNode();
1856 int nodeIndex = getNode()->nodeIndex(); 1856 int nodeIndex = getNode()->nodeIndex();
1857 if (!selectionRange 1857 if (!selectionRange
1858 // Selection is contained in node. 1858 // Selection is contained in node.
1859 || !(parentNode 1859 || !(parentNode
1860 && selectionRange->comparePoint(parentNode, nodeIndex, IGNORE_EXCEPTION) < 0 1860 && selectionRange->comparePoint(parentNode, nodeIndex, IGNORE_EXCEPTION) < 0
1861 && selectionRange->comparePoint(parentNode, nodeIndex + 1, IGNORE_EXCEPT ION) > 0)) { 1861 && selectionRange->comparePoint(parentNode, nodeIndex + 1, IGNORE_EXCEPT ION) > 0)) {
1862 return AXRange(); 1862 return AXRange();
1863 } 1863 }
1864 1864
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 return textControl->indexForVisiblePosition(position); 1908 return textControl->indexForVisiblePosition(position);
1909 } 1909 }
1910 1910
1911 if (!getNode()) 1911 if (!getNode())
1912 return 0; 1912 return 0;
1913 1913
1914 Position indexPosition = position.deepEquivalent(); 1914 Position indexPosition = position.deepEquivalent();
1915 if (indexPosition.isNull()) 1915 if (indexPosition.isNull())
1916 return 0; 1916 return 0;
1917 1917
1918 RefPtrWillBeRawPtr<Range> range = Range::create(*getDocument()); 1918 RawPtr<Range> range = Range::create(*getDocument());
1919 range->setStart(getNode(), 0, IGNORE_EXCEPTION); 1919 range->setStart(getNode(), 0, IGNORE_EXCEPTION);
1920 range->setEnd(indexPosition, IGNORE_EXCEPTION); 1920 range->setEnd(indexPosition, IGNORE_EXCEPTION);
1921 1921
1922 return TextIterator::rangeLength(range->startPosition(), range->endPosition( )); 1922 return TextIterator::rangeLength(range->startPosition(), range->endPosition( ));
1923 } 1923 }
1924 1924
1925 AXLayoutObject* AXLayoutObject::getUnignoredObjectFromNode(Node& node) const 1925 AXLayoutObject* AXLayoutObject::getUnignoredObjectFromNode(Node& node) const
1926 { 1926 {
1927 if (isDetached()) 1927 if (isDetached())
1928 return nullptr; 1928 return nullptr;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 if (!node || !node->isElementNode()) 2214 if (!node || !node->isElementNode())
2215 return false; 2215 return false;
2216 2216
2217 // The ARIA spec says a tab item can also be selected if it is aria-labeled by a tabpanel 2217 // The ARIA spec says a tab item can also be selected if it is aria-labeled by a tabpanel
2218 // that has keyboard focus inside of it, or if a tabpanel in its aria-contro ls list has KB 2218 // that has keyboard focus inside of it, or if a tabpanel in its aria-contro ls list has KB
2219 // focus inside of it. 2219 // focus inside of it.
2220 AXObject* focusedElement = axObjectCache().focusedObject(); 2220 AXObject* focusedElement = axObjectCache().focusedObject();
2221 if (!focusedElement) 2221 if (!focusedElement)
2222 return false; 2222 return false;
2223 2223
2224 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; 2224 HeapVector<Member<Element>> elements;
2225 elementsFromAttribute(elements, aria_controlsAttr); 2225 elementsFromAttribute(elements, aria_controlsAttr);
2226 2226
2227 for (const auto& element : elements) { 2227 for (const auto& element : elements) {
2228 AXObject* tabPanel = axObjectCache().getOrCreate(element); 2228 AXObject* tabPanel = axObjectCache().getOrCreate(element);
2229 2229
2230 // A tab item should only control tab panels. 2230 // A tab item should only control tab panels.
2231 if (!tabPanel || tabPanel->roleValue() != TabPanelRole) 2231 if (!tabPanel || tabPanel->roleValue() != TabPanelRole)
2232 continue; 2232 continue;
2233 2233
2234 AXObject* checkFocusElement = focusedElement; 2234 AXObject* checkFocusElement = focusedElement;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 if (label && label->layoutObject()) { 2523 if (label && label->layoutObject()) {
2524 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2524 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct();
2525 result.unite(labelRect); 2525 result.unite(labelRect);
2526 } 2526 }
2527 } 2527 }
2528 2528
2529 return result; 2529 return result;
2530 } 2530 }
2531 2531
2532 } // namespace blink 2532 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698