Changeset 56989 in webkit
- Timestamp:
- Apr 2, 2010 1:31:14 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r56978 r56989 1 2010-04-02 Roland Steiner <rolandsteiner@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Bug 36741 - Duplicate, slightly divergent implementation of Position[Iterator]::isCandidate() 6 https://bugs.webkit.org/show_bug.cgi?id=36741 7 8 Patch: change Position::isCandididate() to call the PositionIterator::isCandidate() version. 9 Update PositionIterator::isCandidate() to mirror Position::isCandidate(). 10 11 Rationale: PositionIterator::isCandidate() is called in a tight loop within 12 next/previousCandidate(). Also, creation of a PositionIterator from a Position 13 is cheaper than vice-versa. 14 15 Tests: ran all tests in 'editing'. 16 17 * dom/Position.cpp: 18 (WebCore::Position::isCandidate): 19 * dom/PositionIterator.cpp: 20 (WebCore::PositionIterator::isCandidate): 21 1 22 2010-04-02 Steve Falkenburg <sfalken@apple.com> 2 23 -
trunk/WebCore/dom/Position.cpp
r56915 r56989 726 726 bool Position::isCandidate() const 727 727 { 728 if (isNull()) 729 return false; 730 731 RenderObject *renderer = node()->renderer(); 732 if (!renderer) 733 return false; 734 735 if (renderer->style()->visibility() != VISIBLE) 736 return false; 737 738 if (renderer->isBR()) 739 return m_offset == 0 && !nodeIsUserSelectNone(node()->parent()); 740 741 if (renderer->isText()) 742 return inRenderedText() && !nodeIsUserSelectNone(node()); 743 744 if (isTableElement(node()) || editingIgnoresContent(node())) 745 return (atFirstEditingPositionForNode() || atLastEditingPositionForNode()) && !nodeIsUserSelectNone(node()->parent()); 746 747 if (m_anchorNode->hasTagName(htmlTag)) 748 return false; 749 750 if (renderer->isBlockFlow()) { 751 if (toRenderBlock(renderer)->height() || m_anchorNode->hasTagName(bodyTag)) { 752 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer)) 753 return atFirstEditingPositionForNode() && !Position::nodeIsUserSelectNone(node()); 754 return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(node()) && atEditingBoundary(); 755 } 756 } else 757 return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(node()) && atEditingBoundary(); 758 759 return false; 728 return PositionIterator(*this).isCandidate(); 760 729 } 761 730 -
trunk/WebCore/dom/PositionIterator.cpp
r51522 r56989 163 163 return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary(); 164 164 } 165 } 165 } else 166 return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary(); 166 167 167 168 return false;
Note: See TracChangeset
for help on using the changeset viewer.