| 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 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 if (!allowsTextRanges() && !m_renderer->isText()) | 1731 if (!allowsTextRanges() && !m_renderer->isText()) |
| 1732 return VisiblePosition(); | 1732 return VisiblePosition(); |
| 1733 | 1733 |
| 1734 Node* node = m_renderer->node(); | 1734 Node* node = m_renderer->node(); |
| 1735 if (!node) | 1735 if (!node) |
| 1736 return VisiblePosition(); | 1736 return VisiblePosition(); |
| 1737 | 1737 |
| 1738 if (index <= 0) | 1738 if (index <= 0) |
| 1739 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); | 1739 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); |
| 1740 | 1740 |
| 1741 RefPtrWillBeRawPtr<Range> range = Range::create(m_renderer->document()); | 1741 Position start, end; |
| 1742 range->selectNodeContents(node, IGNORE_EXCEPTION); | 1742 bool selected = Range::selectNodeContents(node, start, end); |
| 1743 CharacterIterator it(range.get()); | 1743 if (!selected) |
| 1744 return VisiblePosition(); |
| 1745 |
| 1746 CharacterIterator it(start, end); |
| 1744 it.advance(index - 1); | 1747 it.advance(index - 1); |
| 1745 return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO
ffset(), Position::PositionIsOffsetInAnch\ | 1748 return VisiblePosition(Position(it.endContainer(), it.endOffset(), Position:
:PositionIsOffsetInAnchor), UPSTREAM); |
| 1746 or), UPSTREAM); | |
| 1747 } | 1749 } |
| 1748 | 1750 |
| 1749 int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const | 1751 int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const |
| 1750 { | 1752 { |
| 1751 if (isNativeTextControl() && m_renderer->isTextControl()) { | 1753 if (isNativeTextControl() && m_renderer->isTextControl()) { |
| 1752 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer
)->textFormControlElement(); | 1754 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer
)->textFormControlElement(); |
| 1753 return textControl->indexForVisiblePosition(pos); | 1755 return textControl->indexForVisiblePosition(pos); |
| 1754 } | 1756 } |
| 1755 | 1757 |
| 1756 if (!isTextControl()) | 1758 if (!isTextControl()) |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2342 if (label && label->renderer()) { | 2344 if (label && label->renderer()) { |
| 2343 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2345 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
| 2344 result.unite(labelRect); | 2346 result.unite(labelRect); |
| 2345 } | 2347 } |
| 2346 } | 2348 } |
| 2347 | 2349 |
| 2348 return result; | 2350 return result; |
| 2349 } | 2351 } |
| 2350 | 2352 |
| 2351 } // namespace blink | 2353 } // namespace blink |
| OLD | NEW |