Chromium Code Reviews| Index: Source/core/editing/VisibleUnits.cpp |
| diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp |
| index 5b889d78c5548aa42520fded0d76280dfc430105..c3b11f6a2e2f179c45c4cc751249f0272d4f84f5 100644 |
| --- a/Source/core/editing/VisibleUnits.cpp |
| +++ b/Source/core/editing/VisibleUnits.cpp |
| @@ -216,7 +216,7 @@ static const InlineTextBox* logicallyPreviousBox(const VisiblePosition& visibleP |
| return previousBox; |
| while (1) { |
| - Node* startNode = startBox->renderer() ? startBox->renderer()->nonPseudoNode() : 0; |
| + Node* startNode = startBox->renderer().nonPseudoNode(); |
| if (!startNode) |
| break; |
| @@ -257,7 +257,7 @@ static const InlineTextBox* logicallyNextBox(const VisiblePosition& visiblePosit |
| return nextBox; |
| while (1) { |
| - Node* startNode = startBox->renderer() ? startBox->renderer()->nonPseudoNode() : 0; |
| + Node* startNode =startBox->renderer().nonPseudoNode(); |
| if (!startNode) |
| break; |
| @@ -295,10 +295,10 @@ static TextBreakIterator* wordBreakIteratorForMinOffsetBoundary(const VisiblePos |
| string.clear(); |
| if (previousBox) { |
| previousBoxLength = previousBox->len(); |
| - previousBox->textRenderer()->text().appendTo(string, previousBox->start(), previousBoxLength); |
| + previousBox->textRenderer().text().appendTo(string, previousBox->start(), previousBoxLength); |
| len += previousBoxLength; |
| } |
| - textBox->textRenderer()->text().appendTo(string, textBox->start(), textBox->len()); |
| + textBox->textRenderer().text().appendTo(string, textBox->start(), textBox->len()); |
| len += textBox->len(); |
| return wordBreakIterator(string.data(), len); |
| @@ -314,10 +314,10 @@ static TextBreakIterator* wordBreakIteratorForMaxOffsetBoundary(const VisiblePos |
| int len = 0; |
| string.clear(); |
| - textBox->textRenderer()->text().appendTo(string, textBox->start(), textBox->len()); |
| + textBox->textRenderer().text().appendTo(string, textBox->start(), textBox->len()); |
| len += textBox->len(); |
| if (nextBox) { |
| - nextBox->textRenderer()->text().appendTo(string, nextBox->start(), nextBox->len()); |
| + nextBox->textRenderer().text().appendTo(string, nextBox->start(), nextBox->len()); |
| len += nextBox->len(); |
| } |
| @@ -384,7 +384,7 @@ static VisiblePosition visualWordPosition(const VisiblePosition& visiblePosition |
| else if (offsetInBox == box->caretMaxOffset()) |
| iter = wordBreakIteratorForMaxOffsetBoundary(visiblePosition, textBox, nextBoxInDifferentBlock, string, leafBoxes); |
| else if (movingIntoNewBox) { |
| - iter = wordBreakIterator(textBox->textRenderer()->text(), textBox->start(), textBox->len()); |
| + iter = wordBreakIterator(textBox->textRenderer().text(), textBox->start(), textBox->len()); |
| previouslyVisitedBox = box; |
| } |
| @@ -737,11 +737,7 @@ static VisiblePosition startPositionForLine(const VisiblePosition& c, LineEndpoi |
| if (!startBox) |
| return VisiblePosition(); |
| - RenderObject* startRenderer = startBox->renderer(); |
| - if (!startRenderer) |
| - return VisiblePosition(); |
| - |
| - startNode = startRenderer->nonPseudoNode(); |
| + startNode = startBox->renderer().nonPseudoNode(); |
| if (startNode) |
| break; |
| @@ -808,11 +804,7 @@ static VisiblePosition endPositionForLine(const VisiblePosition& c, LineEndpoint |
| if (!endBox) |
| return VisiblePosition(); |
| - RenderObject* endRenderer = endBox->renderer(); |
| - if (!endRenderer) |
| - return VisiblePosition(); |
| - |
| - endNode = endRenderer->nonPseudoNode(); |
| + endNode = endBox->renderer().nonPseudoNode(); |
| if (endNode) |
| break; |
| @@ -907,12 +899,12 @@ bool isEndOfLine(const VisiblePosition &p) |
| static inline IntPoint absoluteLineDirectionPointToLocalPointInBlock(RootInlineBox* root, int lineDirectionPoint) |
| { |
| ASSERT(root); |
| - RenderBlockFlow* containingBlock = root->block(); |
| + RenderBlockFlow* containingBlock = &root->block(); |
|
Inactive
2014/02/28 02:28:19
RenderBlockFlow& containingBlock = root->block();
ostap
2014/02/28 08:29:14
Done.
|
| FloatPoint absoluteBlockPoint = containingBlock->localToAbsolute(FloatPoint()); |
| if (containingBlock->hasOverflowClip()) |
| absoluteBlockPoint -= containingBlock->scrolledContentOffset(); |
| - if (root->block()->isHorizontalWritingMode()) |
| + if (root->block().isHorizontalWritingMode()) |
| return IntPoint(lineDirectionPoint - absoluteBlockPoint.x(), root->blockDirectionPointInLine()); |
| return IntPoint(root->blockDirectionPointInLine(), lineDirectionPoint - absoluteBlockPoint.y()); |
| @@ -957,11 +949,11 @@ VisiblePosition previousLinePosition(const VisiblePosition &visiblePosition, int |
| if (root) { |
| // FIXME: Can be wrong for multi-column layout and with transforms. |
| IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(root, lineDirectionPoint); |
| - RenderObject* renderer = root->closestLeafChildForPoint(pointInLine, isEditablePosition(p))->renderer(); |
| - Node* node = renderer->node(); |
| + RenderObject& renderer = root->closestLeafChildForPoint(pointInLine, isEditablePosition(p))->renderer(); |
| + Node* node = renderer.node(); |
| if (node && editingIgnoresContent(node)) |
| return VisiblePosition(positionInParentBeforeNode(node)); |
| - return VisiblePosition(renderer->positionForPoint(pointInLine)); |
| + return VisiblePosition(renderer.positionForPoint(pointInLine)); |
| } |
| // Could not find a previous line. This means we must already be on the first line. |
| @@ -1015,11 +1007,11 @@ VisiblePosition nextLinePosition(const VisiblePosition &visiblePosition, int lin |
| if (root) { |
| // FIXME: Can be wrong for multi-column layout and with transforms. |
| IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(root, lineDirectionPoint); |
| - RenderObject* renderer = root->closestLeafChildForPoint(pointInLine, isEditablePosition(p))->renderer(); |
| - Node* node = renderer->node(); |
| + RenderObject& renderer = root->closestLeafChildForPoint(pointInLine, isEditablePosition(p))->renderer(); |
| + Node* node = renderer.node(); |
| if (node && editingIgnoresContent(node)) |
| return VisiblePosition(positionInParentBeforeNode(node)); |
| - return VisiblePosition(renderer->positionForPoint(pointInLine)); |
| + return VisiblePosition(renderer.positionForPoint(pointInLine)); |
| } |
| // Could not find a next line. This means we must already be on the last line. |