OLD | NEW |
---|---|
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 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1583 | 1583 |
1584 // | 1584 // |
1585 // Selected text. | 1585 // Selected text. |
1586 // | 1586 // |
1587 | 1587 |
1588 AXObject::PlainTextRange AXLayoutObject::selectedTextRange() const | 1588 AXObject::PlainTextRange AXLayoutObject::selectedTextRange() const |
1589 { | 1589 { |
1590 if (!isTextControl()) | 1590 if (!isTextControl()) |
1591 return PlainTextRange(); | 1591 return PlainTextRange(); |
1592 | 1592 |
1593 AccessibilityRole ariaRole = ariaRoleAttribute(); | 1593 if (isNativeTextControl() && m_layoutObject->isTextControl()) { |
dmazzoni
2015/04/10 21:23:24
Is this redundant? Any reason this couldn't be jus
| |
1594 if (isNativeTextControl() && ariaRole == UnknownRole && m_layoutObject->isTe xtControl()) { | |
1595 HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutOb ject)->textFormControlElement(); | 1594 HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutOb ject)->textFormControlElement(); |
1596 return PlainTextRange(textControl->selectionStart(), textControl->select ionEnd() - textControl->selectionStart()); | 1595 return PlainTextRange(textControl->selectionStart(), textControl->select ionEnd() - textControl->selectionStart()); |
1597 } | 1596 } |
1598 | 1597 |
1599 if (ariaRole == UnknownRole) | 1598 return visibleSelectionUnderObject(); |
1600 return PlainTextRange(); | |
1601 | |
1602 return ariaSelectedTextRange(); | |
1603 } | 1599 } |
1604 | 1600 |
1605 VisibleSelection AXLayoutObject::selection() const | 1601 VisibleSelection AXLayoutObject::selection() const |
1606 { | 1602 { |
1607 return m_layoutObject->frame()->selection().selection(); | 1603 return m_layoutObject->frame()->selection().selection(); |
1608 } | 1604 } |
1609 | 1605 |
1610 // | 1606 // |
1611 // Modify or take an action on an object. | 1607 // Modify or take an action on an object. |
1612 // | 1608 // |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1781 } | 1777 } |
1782 | 1778 |
1783 if (!isTextControl()) | 1779 if (!isTextControl()) |
1784 return 0; | 1780 return 0; |
1785 | 1781 |
1786 Node* node = m_layoutObject->node(); | 1782 Node* node = m_layoutObject->node(); |
1787 if (!node) | 1783 if (!node) |
1788 return 0; | 1784 return 0; |
1789 | 1785 |
1790 Position indexPosition = pos.deepEquivalent(); | 1786 Position indexPosition = pos.deepEquivalent(); |
1791 if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable AXRole) != node) | 1787 if (indexPosition.isNull() |
1788 || highestEditableRoot(indexPosition) != node | |
1789 && highestEditableRoot(indexPosition, HasEditableAXRole) != node) | |
1792 return 0; | 1790 return 0; |
1793 | 1791 |
1794 RefPtrWillBeRawPtr<Range> range = Range::create(m_layoutObject->document()); | 1792 RefPtrWillBeRawPtr<Range> range = Range::create(m_layoutObject->document()); |
1795 range->setStart(node, 0, IGNORE_EXCEPTION); | 1793 range->setStart(node, 0, IGNORE_EXCEPTION); |
1796 range->setEnd(indexPosition, IGNORE_EXCEPTION); | 1794 range->setEnd(indexPosition, IGNORE_EXCEPTION); |
1797 | 1795 |
1798 return TextIterator::rangeLength(range->startPosition(), range->endPosition( )); | 1796 return TextIterator::rangeLength(range->startPosition(), range->endPosition( )); |
1799 } | 1797 } |
1800 | 1798 |
1801 void AXLayoutObject::addInlineTextBoxChildren(bool force) | 1799 void AXLayoutObject::addInlineTextBoxChildren(bool force) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1870 for (const auto& child : children()) { | 1868 for (const auto& child : children()) { |
1871 // Every child should have aria-role option, and if so, check for select ed attribute/state. | 1869 // Every child should have aria-role option, and if so, check for select ed attribute/state. |
1872 if (child->isSelected() && child->ariaRoleAttribute() == ListBoxOptionRo le) { | 1870 if (child->isSelected() && child->ariaRoleAttribute() == ListBoxOptionRo le) { |
1873 result.append(child); | 1871 result.append(child); |
1874 if (!isMulti) | 1872 if (!isMulti) |
1875 return; | 1873 return; |
1876 } | 1874 } |
1877 } | 1875 } |
1878 } | 1876 } |
1879 | 1877 |
1880 AXObject::PlainTextRange AXLayoutObject::ariaSelectedTextRange() const | 1878 AXObject::PlainTextRange AXLayoutObject::visibleSelectionUnderObject() const |
1881 { | 1879 { |
1882 Node* node = m_layoutObject->node(); | 1880 Node* node = m_layoutObject->node(); |
1883 if (!node) | 1881 if (!node) |
1884 return PlainTextRange(); | 1882 return PlainTextRange(); |
1885 | 1883 |
1886 VisibleSelection visibleSelection = selection(); | 1884 VisibleSelection visibleSelection = selection(); |
1887 RefPtrWillBeRawPtr<Range> currentSelectionRange = visibleSelection.toNormali zedRange(); | 1885 RefPtrWillBeRawPtr<Range> currentSelectionRange = visibleSelection.toNormali zedRange(); |
1888 if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, I GNORE_EXCEPTION)) | 1886 if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, I GNORE_EXCEPTION)) |
1889 return PlainTextRange(); | 1887 return PlainTextRange(); |
1890 | 1888 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2268 if (label && label->layoutObject()) { | 2266 if (label && label->layoutObject()) { |
2269 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); | 2267 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); |
2270 result.unite(labelRect); | 2268 result.unite(labelRect); |
2271 } | 2269 } |
2272 } | 2270 } |
2273 | 2271 |
2274 return result; | 2272 return result; |
2275 } | 2273 } |
2276 | 2274 |
2277 } // namespace blink | 2275 } // namespace blink |
OLD | NEW |