Chromium Code Reviews| 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); |
|
yosin_UTC9
2014/09/12 01:02:24
It seems utilizing |selected| makes cleaner.
if (
Mads Ager (chromium)
2014/09/12 10:52:08
Done.
| |
| 1743 CharacterIterator it(range.get()); | 1743 ASSERT_UNUSED(selected, selected); |
| 1744 CharacterIterator it(start, end); | |
| 1744 it.advance(index - 1); | 1745 it.advance(index - 1); |
| 1745 return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO ffset(), Position::PositionIsOffsetInAnch\ | 1746 return VisiblePosition(Position(it.endContainer(), it.endOffset(), Position: :PositionIsOffsetInAnchor), UPSTREAM); |
| 1746 or), UPSTREAM); | |
| 1747 } | 1747 } |
| 1748 | 1748 |
| 1749 int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const | 1749 int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const |
| 1750 { | 1750 { |
| 1751 if (isNativeTextControl() && m_renderer->isTextControl()) { | 1751 if (isNativeTextControl() && m_renderer->isTextControl()) { |
| 1752 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer )->textFormControlElement(); | 1752 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer )->textFormControlElement(); |
| 1753 return textControl->indexForVisiblePosition(pos); | 1753 return textControl->indexForVisiblePosition(pos); |
| 1754 } | 1754 } |
| 1755 | 1755 |
| 1756 if (!isTextControl()) | 1756 if (!isTextControl()) |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2342 if (label && label->renderer()) { | 2342 if (label && label->renderer()) { |
| 2343 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); | 2343 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); |
| 2344 result.unite(labelRect); | 2344 result.unite(labelRect); |
| 2345 } | 2345 } |
| 2346 } | 2346 } |
| 2347 | 2347 |
| 2348 return result; | 2348 return result; |
| 2349 } | 2349 } |
| 2350 | 2350 |
| 2351 } // namespace blink | 2351 } // namespace blink |
| OLD | NEW |