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

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

Issue 1056763002: Reland: Made content editables report the caret and text selection by treating them as text controls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | Source/modules/accessibility/AXNodeObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 { 1638 {
1639 if (!isAttachment()) 1639 if (!isAttachment())
1640 return 0; 1640 return 0;
1641 return toLayoutPart(m_layoutObject)->widget(); 1641 return toLayoutPart(m_layoutObject)->widget();
1642 } 1642 }
1643 1643
1644 // 1644 //
1645 // Selected text. 1645 // Selected text.
1646 // 1646 //
1647 1647
1648 AXObject::PlainTextRange AXLayoutObject::selectedTextRange() const 1648 AXObject::PlainTextRange AXLayoutObject::selectedTextRange() const
dmazzoni 2015/04/02 06:54:55 I believe this function needs to be updated to han
1649 { 1649 {
1650 if (!isTextControl()) 1650 if (!isTextControl())
1651 return PlainTextRange(); 1651 return PlainTextRange();
1652 1652
1653 AccessibilityRole ariaRole = ariaRoleAttribute(); 1653 AccessibilityRole ariaRole = ariaRoleAttribute();
1654 if (isNativeTextControl() && ariaRole == UnknownRole && m_layoutObject->isTe xtControl()) { 1654 if (isNativeTextControl() && ariaRole == UnknownRole && m_layoutObject->isTe xtControl()) {
1655 HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutOb ject)->textFormControlElement(); 1655 HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutOb ject)->textFormControlElement();
1656 return PlainTextRange(textControl->selectionStart(), textControl->select ionEnd() - textControl->selectionStart()); 1656 return PlainTextRange(textControl->selectionStart(), textControl->select ionEnd() - textControl->selectionStart());
1657 } 1657 }
1658 1658
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 } 1841 }
1842 1842
1843 if (!isTextControl()) 1843 if (!isTextControl())
1844 return 0; 1844 return 0;
1845 1845
1846 Node* node = m_layoutObject->node(); 1846 Node* node = m_layoutObject->node();
1847 if (!node) 1847 if (!node)
1848 return 0; 1848 return 0;
1849 1849
1850 Position indexPosition = pos.deepEquivalent(); 1850 Position indexPosition = pos.deepEquivalent();
1851 if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable AXRole) != node) 1851 if (indexPosition.isNull()
1852 || highestEditableRoot(indexPosition) != node
1853 && highestEditableRoot(indexPosition, HasEditableAXRole) != node)
1852 return 0; 1854 return 0;
1853 1855
1854 RefPtrWillBeRawPtr<Range> range = Range::create(m_layoutObject->document()); 1856 RefPtrWillBeRawPtr<Range> range = Range::create(m_layoutObject->document());
1855 range->setStart(node, 0, IGNORE_EXCEPTION); 1857 range->setStart(node, 0, IGNORE_EXCEPTION);
1856 range->setEnd(indexPosition, IGNORE_EXCEPTION); 1858 range->setEnd(indexPosition, IGNORE_EXCEPTION);
1857 1859
1858 return TextIterator::rangeLength(range->startPosition(), range->endPosition( )); 1860 return TextIterator::rangeLength(range->startPosition(), range->endPosition( ));
1859 } 1861 }
1860 1862
1861 void AXLayoutObject::addInlineTextBoxChildren(bool force) 1863 void AXLayoutObject::addInlineTextBoxChildren(bool force)
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 if (label && label->layoutObject()) { 2369 if (label && label->layoutObject()) {
2368 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2370 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2369 result.unite(labelRect); 2371 result.unite(labelRect);
2370 } 2372 }
2371 } 2373 }
2372 2374
2373 return result; 2375 return result;
2374 } 2376 }
2375 2377
2376 } // namespace blink 2378 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/modules/accessibility/AXNodeObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698