| 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 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 VisiblePositionRange AccessibilityRenderObject::visiblePositionRange() const | 1613 VisiblePositionRange AccessibilityRenderObject::visiblePositionRange() const |
| 1614 { | 1614 { |
| 1615 if (!m_renderer) | 1615 if (!m_renderer) |
| 1616 return VisiblePositionRange(); | 1616 return VisiblePositionRange(); |
| 1617 | 1617 |
| 1618 // construct VisiblePositions for start and end | 1618 // construct VisiblePositions for start and end |
| 1619 Handle<Node> node = m_renderer->node(); | 1619 Handle<Node> node = m_renderer->node(); |
| 1620 if (!node) | 1620 if (!node) |
| 1621 return VisiblePositionRange(); | 1621 return VisiblePositionRange(); |
| 1622 | 1622 |
| 1623 VisiblePosition startPos = firstPositionInOrBeforeNode(node.raw()); | 1623 VisiblePosition startPos = firstPositionInOrBeforeNode(node); |
| 1624 VisiblePosition endPos = lastPositionInOrAfterNode(node.raw()); | 1624 VisiblePosition endPos = lastPositionInOrAfterNode(node); |
| 1625 | 1625 |
| 1626 // the VisiblePositions are equal for nodes like buttons, so adjust for that | 1626 // the VisiblePositions are equal for nodes like buttons, so adjust for that |
| 1627 // FIXME: Really? [button, 0] and [button, 1] are distinct (before and afte
r the button) | 1627 // FIXME: Really? [button, 0] and [button, 1] are distinct (before and afte
r the button) |
| 1628 // I expect this code is only hit for things like empty divs? In which case
I don't think | 1628 // I expect this code is only hit for things like empty divs? In which case
I don't think |
| 1629 // the behavior is correct here -- eseidel | 1629 // the behavior is correct here -- eseidel |
| 1630 if (startPos == endPos) { | 1630 if (startPos == endPos) { |
| 1631 endPos = endPos.next(); | 1631 endPos = endPos.next(); |
| 1632 if (endPos.isNull()) | 1632 if (endPos.isNull()) |
| 1633 endPos = startPos; | 1633 endPos = startPos; |
| 1634 } | 1634 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 return toRenderTextControl(m_renderer)->textFormControlElement()->visibl
ePositionForIndex(index); | 1673 return toRenderTextControl(m_renderer)->textFormControlElement()->visibl
ePositionForIndex(index); |
| 1674 | 1674 |
| 1675 if (!allowsTextRanges() && !m_renderer->isText()) | 1675 if (!allowsTextRanges() && !m_renderer->isText()) |
| 1676 return VisiblePosition(); | 1676 return VisiblePosition(); |
| 1677 | 1677 |
| 1678 Handle<Node> node = m_renderer->node(); | 1678 Handle<Node> node = m_renderer->node(); |
| 1679 if (!node) | 1679 if (!node) |
| 1680 return VisiblePosition(); | 1680 return VisiblePosition(); |
| 1681 | 1681 |
| 1682 if (index <= 0) | 1682 if (index <= 0) |
| 1683 return VisiblePosition(firstPositionInOrBeforeNode(node.raw()), DOWNSTRE
AM); | 1683 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); |
| 1684 | 1684 |
| 1685 Handle<Range> range = Range::create(m_renderer->document()); | 1685 Handle<Range> range = Range::create(m_renderer->document()); |
| 1686 range->selectNodeContents(node, IGNORE_EXCEPTION); | 1686 range->selectNodeContents(node, IGNORE_EXCEPTION); |
| 1687 CharacterIterator it(range); | 1687 CharacterIterator it(range); |
| 1688 it.advance(index - 1); | 1688 it.advance(index - 1); |
| 1689 return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO
ffset(), Position::PositionIsOffsetInAnchor), UPSTREAM); | 1689 return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO
ffset(), Position::PositionIsOffsetInAnchor), UPSTREAM); |
| 1690 } | 1690 } |
| 1691 | 1691 |
| 1692 int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
s) const | 1692 int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
s) const |
| 1693 { | 1693 { |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3067 | 3067 |
| 3068 RenderBox* box = toRenderBox(m_renderer); | 3068 RenderBox* box = toRenderBox(m_renderer); |
| 3069 if (!box->canBeScrolledAndHasScrollableArea()) | 3069 if (!box->canBeScrolledAndHasScrollableArea()) |
| 3070 return; | 3070 return; |
| 3071 | 3071 |
| 3072 RenderLayer* layer = box->layer(); | 3072 RenderLayer* layer = box->layer(); |
| 3073 layer->scrollToOffset(toIntSize(point), RenderLayer::ScrollOffsetClamped); | 3073 layer->scrollToOffset(toIntSize(point), RenderLayer::ScrollOffsetClamped); |
| 3074 } | 3074 } |
| 3075 | 3075 |
| 3076 } // namespace WebCore | 3076 } // namespace WebCore |
| OLD | NEW |