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

Side by Side Diff: Source/core/rendering/RenderBlock.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, 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/InlineTextBox.cpp ('k') | Source/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 3028 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 } 3039 }
3040 3040
3041 return false; 3041 return false;
3042 } 3042 }
3043 3043
3044 Position RenderBlock::positionForBox(InlineBox *box, bool start) const 3044 Position RenderBlock::positionForBox(InlineBox *box, bool start) const
3045 { 3045 {
3046 if (!box) 3046 if (!box)
3047 return Position(); 3047 return Position();
3048 3048
3049 if (!box->renderer()->nonPseudoNode()) 3049 if (!box->renderer().nonPseudoNode())
3050 return createLegacyEditingPosition(nonPseudoNode(), start ? caretMinOffs et() : caretMaxOffset()); 3050 return createLegacyEditingPosition(nonPseudoNode(), start ? caretMinOffs et() : caretMaxOffset());
3051 3051
3052 if (!box->isInlineTextBox()) 3052 if (!box->isInlineTextBox())
3053 return createLegacyEditingPosition(box->renderer()->nonPseudoNode(), sta rt ? box->renderer()->caretMinOffset() : box->renderer()->caretMaxOffset()); 3053 return createLegacyEditingPosition(box->renderer().nonPseudoNode(), star t ? box->renderer().caretMinOffset() : box->renderer().caretMaxOffset());
3054 3054
3055 InlineTextBox* textBox = toInlineTextBox(box); 3055 InlineTextBox* textBox = toInlineTextBox(box);
3056 return createLegacyEditingPosition(box->renderer()->nonPseudoNode(), start ? textBox->start() : textBox->start() + textBox->len()); 3056 return createLegacyEditingPosition(box->renderer().nonPseudoNode(), start ? textBox->start() : textBox->start() + textBox->len());
3057 } 3057 }
3058 3058
3059 static inline bool isEditingBoundary(RenderObject* ancestor, RenderObject* child ) 3059 static inline bool isEditingBoundary(RenderObject* ancestor, RenderObject* child )
3060 { 3060 {
3061 ASSERT(!ancestor || ancestor->nonPseudoNode()); 3061 ASSERT(!ancestor || ancestor->nonPseudoNode());
3062 ASSERT(child && child->nonPseudoNode()); 3062 ASSERT(child && child->nonPseudoNode());
3063 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor ->parent()->isRenderView()) 3063 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor ->parent()->isRenderView())
3064 || ancestor->nonPseudoNode()->rendererIsEditable() == child->nonPseudoNo de()->rendererIsEditable(); 3064 || ancestor->nonPseudoNode()->rendererIsEditable() == child->nonPseudoNo de()->rendererIsEditable();
3065 } 3065 }
3066 3066
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 } 3161 }
3162 // y coordinate is above first root line box, so return the star t of the first 3162 // y coordinate is above first root line box, so return the star t of the first
3163 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA M); 3163 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA M);
3164 } 3164 }
3165 } 3165 }
3166 3166
3167 // pass the box a top position that is inside it 3167 // pass the box a top position that is inside it
3168 LayoutPoint point(pointInLogicalContents.x(), closestBox->root()->blockD irectionPointInLine()); 3168 LayoutPoint point(pointInLogicalContents.x(), closestBox->root()->blockD irectionPointInLine());
3169 if (!isHorizontalWritingMode()) 3169 if (!isHorizontalWritingMode())
3170 point = point.transposedPoint(); 3170 point = point.transposedPoint();
3171 if (closestBox->renderer()->isReplaced()) 3171 if (closestBox->renderer().isReplaced())
3172 return positionForPointRespectingEditingBoundaries(this, toRenderBox (closestBox->renderer()), point); 3172 return positionForPointRespectingEditingBoundaries(this, &toRenderBo x(closestBox->renderer()), point);
3173 return closestBox->renderer()->positionForPoint(point); 3173 return closestBox->renderer().positionForPoint(point);
3174 } 3174 }
3175 3175
3176 if (lastRootBoxWithChildren) { 3176 if (lastRootBoxWithChildren) {
3177 // We hit this case for Mac behavior when the Y coordinate is below the last box. 3177 // We hit this case for Mac behavior when the Y coordinate is below the last box.
3178 ASSERT(moveCaretToBoundary); 3178 ASSERT(moveCaretToBoundary);
3179 InlineBox* logicallyLastBox; 3179 InlineBox* logicallyLastBox;
3180 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) 3180 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox))
3181 return PositionWithAffinity(positionForBox(logicallyLastBox, false), DOWNSTREAM); 3181 return PositionWithAffinity(positionForBox(logicallyLastBox, false), DOWNSTREAM);
3182 } 3182 }
3183 3183
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
5019 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5019 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5020 { 5020 {
5021 showRenderObject(); 5021 showRenderObject();
5022 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5022 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5023 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5023 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5024 } 5024 }
5025 5025
5026 #endif 5026 #endif
5027 5027
5028 } // namespace WebCore 5028 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineTextBox.cpp ('k') | Source/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698