Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: Source/core/dom/Range.cpp

Issue 1000533004: Move implementation of Range::firstNode and Range::pastLastNode to Position (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-03-13T16:48:34 Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index dffd506bc95c1120b7bb0e26b1ce20e35a1bc6cc..a27e461926f28db32139dffb77454fcbbe4abe0f 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -1414,13 +1414,7 @@ void Range::checkExtractPrecondition(ExceptionState& exceptionState)
Node* Range::firstNode() const
{
- if (m_start.container()->offsetInCharacters())
- return m_start.container();
- if (Node* child = NodeTraversal::childAt(*m_start.container(), m_start.offset()))
- return child;
- if (!m_start.offset())
- return m_start.container();
- return NodeTraversal::nextSkippingChildren(*m_start.container());
+ return startPosition().toOffsetInAnchor().nodeAsRangeFirstNode();
sof 2015/05/05 08:23:23 Is this a meaning-preserving transformation - what
}
ShadowRoot* Range::shadowRoot() const
@@ -1430,11 +1424,7 @@ ShadowRoot* Range::shadowRoot() const
Node* Range::pastLastNode() const
{
- if (m_end.container()->offsetInCharacters())
- return NodeTraversal::nextSkippingChildren(*m_end.container());
- if (Node* child = NodeTraversal::childAt(*m_end.container(), m_end.offset()))
- return child;
- return NodeTraversal::nextSkippingChildren(*m_end.container());
+ return endPosition().toOffsetInAnchor().nodeAsRangePastLastNode();
}
IntRect Range::boundingBox() const
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698