| 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 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1886         return VisiblePosition(); | 1886         return VisiblePosition(); | 
| 1887 | 1887 | 
| 1888     Node* node = m_renderer->node(); | 1888     Node* node = m_renderer->node(); | 
| 1889     if (!node) | 1889     if (!node) | 
| 1890         return VisiblePosition(); | 1890         return VisiblePosition(); | 
| 1891 | 1891 | 
| 1892     if (index <= 0) | 1892     if (index <= 0) | 
| 1893         return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); | 1893         return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); | 
| 1894 | 1894 | 
| 1895     RefPtr<Range> range = Range::create(m_renderer->document()); | 1895     RefPtr<Range> range = Range::create(m_renderer->document()); | 
| 1896     range->selectNodeContents(node, IGNORE_EXCEPTION_STATE); | 1896     range->selectNodeContents(node, IGNORE_EXCEPTION); | 
| 1897     CharacterIterator it(range.get()); | 1897     CharacterIterator it(range.get()); | 
| 1898     it.advance(index - 1); | 1898     it.advance(index - 1); | 
| 1899     return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO
      ffset(), Position::PositionIsOffsetInAnch\ | 1899     return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO
      ffset(), Position::PositionIsOffsetInAnch\ | 
| 1900 or), UPSTREAM); | 1900 or), UPSTREAM); | 
| 1901 } | 1901 } | 
| 1902 | 1902 | 
| 1903 int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
      s) const | 1903 int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
      s) const | 
| 1904 { | 1904 { | 
| 1905     if (isNativeTextControl()) { | 1905     if (isNativeTextControl()) { | 
| 1906         HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer
      )->textFormControlElement(); | 1906         HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer
      )->textFormControlElement(); | 
| 1907         return textControl->indexForVisiblePosition(pos); | 1907         return textControl->indexForVisiblePosition(pos); | 
| 1908     } | 1908     } | 
| 1909 | 1909 | 
| 1910     if (!isTextControl()) | 1910     if (!isTextControl()) | 
| 1911         return 0; | 1911         return 0; | 
| 1912 | 1912 | 
| 1913     Node* node = m_renderer->node(); | 1913     Node* node = m_renderer->node(); | 
| 1914     if (!node) | 1914     if (!node) | 
| 1915         return 0; | 1915         return 0; | 
| 1916 | 1916 | 
| 1917     Position indexPosition = pos.deepEquivalent(); | 1917     Position indexPosition = pos.deepEquivalent(); | 
| 1918     if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable
      AXRole) != node) | 1918     if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable
      AXRole) != node) | 
| 1919         return 0; | 1919         return 0; | 
| 1920 | 1920 | 
| 1921     RefPtr<Range> range = Range::create(m_renderer->document()); | 1921     RefPtr<Range> range = Range::create(m_renderer->document()); | 
| 1922     range->setStart(node, 0, IGNORE_EXCEPTION_STATE); | 1922     range->setStart(node, 0, IGNORE_EXCEPTION); | 
| 1923     range->setEnd(indexPosition, IGNORE_EXCEPTION_STATE); | 1923     range->setEnd(indexPosition, IGNORE_EXCEPTION); | 
| 1924 | 1924 | 
| 1925     return TextIterator::rangeLength(range.get()); | 1925     return TextIterator::rangeLength(range.get()); | 
| 1926 } | 1926 } | 
| 1927 | 1927 | 
| 1928 void AccessibilityRenderObject::lineBreaks(Vector<int>& lineBreaks) const | 1928 void AccessibilityRenderObject::lineBreaks(Vector<int>& lineBreaks) const | 
| 1929 { | 1929 { | 
| 1930     if (!isTextControl()) | 1930     if (!isTextControl()) | 
| 1931         return; | 1931         return; | 
| 1932 | 1932 | 
| 1933     VisiblePosition visiblePos = visiblePositionForIndex(0); | 1933     VisiblePosition visiblePos = visiblePositionForIndex(0); | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2011 } | 2011 } | 
| 2012 | 2012 | 
| 2013 PlainTextRange AccessibilityRenderObject::ariaSelectedTextRange() const | 2013 PlainTextRange AccessibilityRenderObject::ariaSelectedTextRange() const | 
| 2014 { | 2014 { | 
| 2015     Node* node = m_renderer->node(); | 2015     Node* node = m_renderer->node(); | 
| 2016     if (!node) | 2016     if (!node) | 
| 2017         return PlainTextRange(); | 2017         return PlainTextRange(); | 
| 2018 | 2018 | 
| 2019     VisibleSelection visibleSelection = selection(); | 2019     VisibleSelection visibleSelection = selection(); | 
| 2020     RefPtr<Range> currentSelectionRange = visibleSelection.toNormalizedRange(); | 2020     RefPtr<Range> currentSelectionRange = visibleSelection.toNormalizedRange(); | 
| 2021     if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, I
      GNORE_EXCEPTION_STATE)) | 2021     if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, I
      GNORE_EXCEPTION)) | 
| 2022         return PlainTextRange(); | 2022         return PlainTextRange(); | 
| 2023 | 2023 | 
| 2024     int start = indexForVisiblePosition(visibleSelection.start()); | 2024     int start = indexForVisiblePosition(visibleSelection.start()); | 
| 2025     int end = indexForVisiblePosition(visibleSelection.end()); | 2025     int end = indexForVisiblePosition(visibleSelection.end()); | 
| 2026 | 2026 | 
| 2027     return PlainTextRange(start, end - start); | 2027     return PlainTextRange(start, end - start); | 
| 2028 } | 2028 } | 
| 2029 | 2029 | 
| 2030 bool AccessibilityRenderObject::nodeIsTextControl(const Node* node) const | 2030 bool AccessibilityRenderObject::nodeIsTextControl(const Node* node) const | 
| 2031 { | 2031 { | 
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2514         if (label && label->renderer()) { | 2514         if (label && label->renderer()) { | 
| 2515             LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
      ect(); | 2515             LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
      ect(); | 
| 2516             result.unite(labelRect); | 2516             result.unite(labelRect); | 
| 2517         } | 2517         } | 
| 2518     } | 2518     } | 
| 2519 | 2519 | 
| 2520     return result; | 2520     return result; | 
| 2521 } | 2521 } | 
| 2522 | 2522 | 
| 2523 } // namespace WebCore | 2523 } // namespace WebCore | 
| OLD | NEW | 
|---|