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

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 182413005: Return refererence from InlineBox::root() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-upload because previous patch didn't upload correctly. 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
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 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 1606
1607 void RenderBlock::simplifiedNormalFlowLayout() 1607 void RenderBlock::simplifiedNormalFlowLayout()
1608 { 1608 {
1609 if (childrenInline()) { 1609 if (childrenInline()) {
1610 ListHashSet<RootInlineBox*> lineBoxes; 1610 ListHashSet<RootInlineBox*> lineBoxes;
1611 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { 1611 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
1612 RenderObject* o = walker.current(); 1612 RenderObject* o = walker.current();
1613 if (!o->isOutOfFlowPositioned() && (o->isReplaced() || o->isFloating ())) { 1613 if (!o->isOutOfFlowPositioned() && (o->isReplaced() || o->isFloating ())) {
1614 o->layoutIfNeeded(); 1614 o->layoutIfNeeded();
1615 if (toRenderBox(o)->inlineBoxWrapper()) { 1615 if (toRenderBox(o)->inlineBoxWrapper()) {
1616 RootInlineBox* box = toRenderBox(o)->inlineBoxWrapper()->roo t(); 1616 RootInlineBox& box = toRenderBox(o)->inlineBoxWrapper()->roo t();
1617 lineBoxes.add(box); 1617 lineBoxes.add(&box);
1618 } 1618 }
1619 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl ine())) { 1619 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl ine())) {
1620 o->clearNeedsLayout(); 1620 o->clearNeedsLayout();
1621 } 1621 }
1622 } 1622 }
1623 1623
1624 // FIXME: Glyph overflow will get lost in this case, but not really a bi g deal. 1624 // FIXME: Glyph overflow will get lost in this case, but not really a bi g deal.
1625 GlyphOverflowAndFallbackFontsMap textBoxDataMap; 1625 GlyphOverflowAndFallbackFontsMap textBoxDataMap;
1626 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) { 1626 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) {
1627 RootInlineBox* box = *it; 1627 RootInlineBox* box = *it;
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
3157 if (box->isLineBreak()) { 3157 if (box->isLineBreak()) {
3158 if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak( )) 3158 if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak( ))
3159 box = newBox; 3159 box = newBox;
3160 } 3160 }
3161 // y coordinate is above first root line box, so return the star t of the first 3161 // y coordinate is above first root line box, so return the star t of the first
3162 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA M); 3162 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA M);
3163 } 3163 }
3164 } 3164 }
3165 3165
3166 // pass the box a top position that is inside it 3166 // pass the box a top position that is inside it
3167 LayoutPoint point(pointInLogicalContents.x(), closestBox->root()->blockD irectionPointInLine()); 3167 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi rectionPointInLine());
3168 if (!isHorizontalWritingMode()) 3168 if (!isHorizontalWritingMode())
3169 point = point.transposedPoint(); 3169 point = point.transposedPoint();
3170 if (closestBox->renderer().isReplaced()) 3170 if (closestBox->renderer().isReplaced())
3171 return positionForPointRespectingEditingBoundaries(this, &toRenderBo x(closestBox->renderer()), point); 3171 return positionForPointRespectingEditingBoundaries(this, &toRenderBo x(closestBox->renderer()), point);
3172 return closestBox->renderer().positionForPoint(point); 3172 return closestBox->renderer().positionForPoint(point);
3173 } 3173 }
3174 3174
3175 if (lastRootBoxWithChildren) { 3175 if (lastRootBoxWithChildren) {
3176 // We hit this case for Mac behavior when the Y coordinate is below the last box. 3176 // We hit this case for Mac behavior when the Y coordinate is below the last box.
3177 ASSERT(moveCaretToBoundary); 3177 ASSERT(moveCaretToBoundary);
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
5018 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5018 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5019 { 5019 {
5020 showRenderObject(); 5020 showRenderObject();
5021 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5021 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5022 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5022 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5023 } 5023 }
5024 5024
5025 #endif 5025 #endif
5026 5026
5027 } // namespace WebCore 5027 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698