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 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 if (!allowsTextRanges() && !m_renderer->isText()) | 1759 if (!allowsTextRanges() && !m_renderer->isText()) |
1760 return VisiblePosition(); | 1760 return VisiblePosition(); |
1761 | 1761 |
1762 Node* node = m_renderer->node(); | 1762 Node* node = m_renderer->node(); |
1763 if (!node) | 1763 if (!node) |
1764 return VisiblePosition(); | 1764 return VisiblePosition(); |
1765 | 1765 |
1766 if (index <= 0) | 1766 if (index <= 0) |
1767 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); | 1767 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); |
1768 | 1768 |
1769 RefPtr<Range> range = Range::create(&m_renderer->document()); | 1769 RefPtr<Range> range = Range::create(m_renderer->document()); |
1770 range->selectNodeContents(node, IGNORE_EXCEPTION); | 1770 range->selectNodeContents(node, IGNORE_EXCEPTION); |
1771 CharacterIterator it(range.get()); | 1771 CharacterIterator it(range.get()); |
1772 it.advance(index - 1); | 1772 it.advance(index - 1); |
1773 return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO
ffset(), Position::PositionIsOffsetInAnch\ | 1773 return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO
ffset(), Position::PositionIsOffsetInAnch\ |
1774 or), UPSTREAM); | 1774 or), UPSTREAM); |
1775 } | 1775 } |
1776 | 1776 |
1777 int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
s) const | 1777 int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
s) const |
1778 { | 1778 { |
1779 if (isNativeTextControl() && m_renderer->isTextControl()) { | 1779 if (isNativeTextControl() && m_renderer->isTextControl()) { |
1780 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer
)->textFormControlElement(); | 1780 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer
)->textFormControlElement(); |
1781 return textControl->indexForVisiblePosition(pos); | 1781 return textControl->indexForVisiblePosition(pos); |
1782 } | 1782 } |
1783 | 1783 |
1784 if (!isTextControl()) | 1784 if (!isTextControl()) |
1785 return 0; | 1785 return 0; |
1786 | 1786 |
1787 Node* node = m_renderer->node(); | 1787 Node* node = m_renderer->node(); |
1788 if (!node) | 1788 if (!node) |
1789 return 0; | 1789 return 0; |
1790 | 1790 |
1791 Position indexPosition = pos.deepEquivalent(); | 1791 Position indexPosition = pos.deepEquivalent(); |
1792 if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable
AXRole) != node) | 1792 if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable
AXRole) != node) |
1793 return 0; | 1793 return 0; |
1794 | 1794 |
1795 RefPtr<Range> range = Range::create(&m_renderer->document()); | 1795 RefPtr<Range> range = Range::create(m_renderer->document()); |
1796 range->setStart(node, 0, IGNORE_EXCEPTION); | 1796 range->setStart(node, 0, IGNORE_EXCEPTION); |
1797 range->setEnd(indexPosition, IGNORE_EXCEPTION); | 1797 range->setEnd(indexPosition, IGNORE_EXCEPTION); |
1798 | 1798 |
1799 return TextIterator::rangeLength(range.get()); | 1799 return TextIterator::rangeLength(range.get()); |
1800 } | 1800 } |
1801 | 1801 |
1802 void AccessibilityRenderObject::lineBreaks(Vector<int>& lineBreaks) const | 1802 void AccessibilityRenderObject::lineBreaks(Vector<int>& lineBreaks) const |
1803 { | 1803 { |
1804 if (!isTextControl()) | 1804 if (!isTextControl()) |
1805 return; | 1805 return; |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 if (label && label->renderer()) { | 2374 if (label && label->renderer()) { |
2375 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2375 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
2376 result.unite(labelRect); | 2376 result.unite(labelRect); |
2377 } | 2377 } |
2378 } | 2378 } |
2379 | 2379 |
2380 return result; | 2380 return result; |
2381 } | 2381 } |
2382 | 2382 |
2383 } // namespace WebCore | 2383 } // namespace WebCore |
OLD | NEW |