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

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

Issue 390173003: When accessing line boxes, use RenderBlockFlow instead of RenderBlock. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockFlow.h » ('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 4200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4211 static bool shouldCheckLines(RenderObject* obj) 4211 static bool shouldCheckLines(RenderObject* obj)
4212 { 4212 {
4213 return !obj->isFloatingOrOutOfFlowPositioned() 4213 return !obj->isFloatingOrOutOfFlowPositioned()
4214 && obj->isRenderBlock() && obj->style()->height().isAuto() 4214 && obj->isRenderBlock() && obj->style()->height().isAuto()
4215 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT ICAL); 4215 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT ICAL);
4216 } 4216 }
4217 4217
4218 static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom, int& count) 4218 static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom, int& count)
4219 { 4219 {
4220 if (block->style()->visibility() == VISIBLE) { 4220 if (block->style()->visibility() == VISIBLE) {
4221 if (block->childrenInline()) { 4221 if (block->isRenderBlockFlow() && block->childrenInline()) {
4222 for (RootInlineBox* box = block->firstRootBox(); box; box = box->nex tRootBox()) { 4222 for (RootInlineBox* box = toRenderBlockFlow(block)->firstRootBox(); box; box = box->nextRootBox()) {
4223 if (++count == l) 4223 if (++count == l)
4224 return box->lineBottom() + (includeBottom ? (block->borderBo ttom() + block->paddingBottom()) : LayoutUnit()); 4224 return box->lineBottom() + (includeBottom ? (block->borderBo ttom() + block->paddingBottom()) : LayoutUnit());
4225 } 4225 }
4226 } 4226 } else {
4227 else {
4228 RenderBox* normalFlowChildWithoutLines = 0; 4227 RenderBox* normalFlowChildWithoutLines = 0;
4229 for (RenderBox* obj = block->firstChildBox(); obj; obj = obj->nextSi blingBox()) { 4228 for (RenderBox* obj = block->firstChildBox(); obj; obj = obj->nextSi blingBox()) {
4230 if (shouldCheckLines(obj)) { 4229 if (shouldCheckLines(obj)) {
4231 int result = getHeightForLineCount(toRenderBlock(obj), l, fa lse, count); 4230 int result = getHeightForLineCount(toRenderBlock(obj), l, fa lse, count);
4232 if (result != -1) 4231 if (result != -1)
4233 return result + obj->y() + (includeBottom ? (block->bord erBottom() + block->paddingBottom()) : LayoutUnit()); 4232 return result + obj->y() + (includeBottom ? (block->bord erBottom() + block->paddingBottom()) : LayoutUnit());
4234 } else if (!obj->isFloatingOrOutOfFlowPositioned()) 4233 } else if (!obj->isFloatingOrOutOfFlowPositioned()) {
4235 normalFlowChildWithoutLines = obj; 4234 normalFlowChildWithoutLines = obj;
4235 }
4236 } 4236 }
4237 if (normalFlowChildWithoutLines && l == 0) 4237 if (normalFlowChildWithoutLines && l == 0)
4238 return normalFlowChildWithoutLines->y() + normalFlowChildWithout Lines->height(); 4238 return normalFlowChildWithoutLines->y() + normalFlowChildWithout Lines->height();
4239 } 4239 }
4240 } 4240 }
4241 4241
4242 return -1; 4242 return -1;
4243 } 4243 }
4244 4244
4245 RootInlineBox* RenderBlock::lineAtIndex(int i) const 4245 RootInlineBox* RenderBlock::lineAtIndex(int i) const
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
4900 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 4900 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
4901 { 4901 {
4902 showRenderObject(); 4902 showRenderObject();
4903 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 4903 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
4904 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 4904 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
4905 } 4905 }
4906 4906
4907 #endif 4907 #endif
4908 4908
4909 } // namespace blink 4909 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698