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

Unified Diff: Source/core/editing/VisiblePosition.cpp

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move m_renderer on its old place to avoid InlineBox object size increase. Created 6 years, 10 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/editing/RenderedPosition.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisiblePosition.cpp
diff --git a/Source/core/editing/VisiblePosition.cpp b/Source/core/editing/VisiblePosition.cpp
index 144277006bb1fbf12872207fadb3e694ac279d6d..3c755622b348e251ef55029ac6bf4c5ecd61cb90 100644
--- a/Source/core/editing/VisiblePosition.cpp
+++ b/Source/core/editing/VisiblePosition.cpp
@@ -135,13 +135,13 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
if (!box)
return primaryDirection == LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
- RenderObject* renderer = box->renderer();
+ RenderObject& renderer = box->renderer();
while (true) {
- if ((renderer->isReplaced() || renderer->isBR()) && offset == box->caretRightmostOffset())
+ if ((renderer.isReplaced() || renderer.isBR()) && offset == box->caretRightmostOffset())
return box->isLeftToRightDirection() ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
- if (!renderer->node()) {
+ if (!renderer.node()) {
box = box->prevLeafChild();
if (!box)
return primaryDirection == LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
@@ -150,7 +150,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
continue;
}
- offset = box->isLeftToRightDirection() ? renderer->previousOffset(offset) : renderer->nextOffset(offset);
+ offset = box->isLeftToRightDirection() ? renderer.previousOffset(offset) : renderer.nextOffset(offset);
int caretMinOffset = box->caretMinOffset();
int caretMaxOffset = box->caretMaxOffset();
@@ -217,7 +217,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
continue;
}
- while (prevBox && !prevBox->renderer()->node())
+ while (prevBox && !prevBox->renderer().node())
prevBox = prevBox->prevLeafChild();
if (prevBox) {
@@ -258,7 +258,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
break;
}
- p = createLegacyEditingPosition(renderer->node(), offset);
+ p = createLegacyEditingPosition(renderer.node(), offset);
if ((p.isCandidate() && p.downstream() != downstreamStart) || p.atStartOfTree() || p.atEndOfTree())
return p;
@@ -300,13 +300,13 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
if (!box)
return primaryDirection == LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
- RenderObject* renderer = box->renderer();
+ RenderObject& renderer = box->renderer();
while (true) {
- if ((renderer->isReplaced() || renderer->isBR()) && offset == box->caretLeftmostOffset())
+ if ((renderer.isReplaced() || renderer.isBR()) && offset == box->caretLeftmostOffset())
return box->isLeftToRightDirection() ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
- if (!renderer->node()) {
+ if (!renderer.node()) {
box = box->nextLeafChild();
if (!box)
return primaryDirection == LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
@@ -315,7 +315,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
continue;
}
- offset = box->isLeftToRightDirection() ? renderer->nextOffset(offset) : renderer->previousOffset(offset);
+ offset = box->isLeftToRightDirection() ? renderer.nextOffset(offset) : renderer.previousOffset(offset);
int caretMinOffset = box->caretMinOffset();
int caretMaxOffset = box->caretMaxOffset();
@@ -384,7 +384,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
continue;
}
- while (nextBox && !nextBox->renderer()->node())
+ while (nextBox && !nextBox->renderer().node())
nextBox = nextBox->nextLeafChild();
if (nextBox) {
@@ -426,7 +426,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
break;
}
- p = createLegacyEditingPosition(renderer->node(), offset);
+ p = createLegacyEditingPosition(renderer.node(), offset);
if ((p.isCandidate() && p.downstream() != downstreamStart) || p.atStartOfTree() || p.atEndOfTree())
return p;
@@ -664,7 +664,7 @@ LayoutRect VisiblePosition::localCaretRect(RenderObject*& renderer) const
getInlineBoxAndOffset(inlineBox, caretOffset);
if (inlineBox)
- renderer = inlineBox->renderer();
+ renderer = &inlineBox->renderer();
return renderer->localCaretRect(inlineBox, caretOffset);
}
« no previous file with comments | « Source/core/editing/RenderedPosition.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698