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

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: No reference reassignment. 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..375f273076e196111d0972040b91d2918e5e5e37 100644
--- a/Source/core/editing/VisiblePosition.cpp
+++ b/Source/core/editing/VisiblePosition.cpp
@@ -135,7 +135,7 @@ 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())
@@ -145,7 +145,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
box = box->prevLeafChild();
if (!box)
return primaryDirection == LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = box->caretRightmostOffset();
continue;
}
@@ -176,7 +176,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
// Reposition at the other logical position corresponding to our edge's visual position and go for another round.
box = prevBox;
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = prevBox->caretRightmostOffset();
continue;
}
@@ -191,7 +191,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
InlineBox* logicalStart = 0;
if (primaryDirection == LTR ? box->root()->getLogicalStartBoxWithNode(logicalStart) : box->root()->getLogicalEndBoxWithNode(logicalStart)) {
box = logicalStart;
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = primaryDirection == LTR ? box->caretMinOffset() : box->caretMaxOffset();
}
break;
@@ -210,19 +210,19 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
break;
box = prevBox;
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = box->caretRightmostOffset();
if (box->direction() == primaryDirection)
break;
continue;
}
- while (prevBox && !prevBox->renderer()->node())
+ while (prevBox && !prevBox->renderer().node())
prevBox = prevBox->prevLeafChild();
if (prevBox) {
box = prevBox;
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = box->caretRightmostOffset();
if (box->bidiLevel() > level) {
do {
@@ -252,7 +252,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
break;
level = box->bidiLevel();
}
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = primaryDirection == LTR ? box->caretMinOffset() : box->caretMaxOffset();
}
break;
@@ -300,7 +300,7 @@ 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())
@@ -310,7 +310,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
box = box->nextLeafChild();
if (!box)
return primaryDirection == LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = box->caretLeftmostOffset();
continue;
}
@@ -341,7 +341,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
// Reposition at the other logical position corresponding to our edge's visual position and go for another round.
box = nextBox;
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = nextBox->caretLeftmostOffset();
continue;
}
@@ -356,7 +356,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
InlineBox* logicalEnd = 0;
if (primaryDirection == LTR ? box->root()->getLogicalEndBoxWithNode(logicalEnd) : box->root()->getLogicalStartBoxWithNode(logicalEnd)) {
box = logicalEnd;
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = primaryDirection == LTR ? box->caretMaxOffset() : box->caretMinOffset();
}
break;
@@ -377,19 +377,19 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
// For example, abc 123 ^ CBA or 123 ^ CBA abc
box = nextBox;
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = box->caretLeftmostOffset();
if (box->direction() == primaryDirection)
break;
continue;
}
- while (nextBox && !nextBox->renderer()->node())
+ while (nextBox && !nextBox->renderer().node())
nextBox = nextBox->nextLeafChild();
if (nextBox) {
box = nextBox;
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = box->caretLeftmostOffset();
if (box->bidiLevel() > level) {
@@ -420,7 +420,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
break;
level = box->bidiLevel();
}
- renderer = box->renderer();
+ renderer = &box->renderer();
offset = primaryDirection == LTR ? box->caretMaxOffset() : box->caretMinOffset();
}
break;
@@ -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