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

Side by Side Diff: Source/core/layout/LayoutBlockFlowLine.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/LayoutBox.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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return false; 100 return false;
101 } 101 }
102 102
103 InlineFlowBox* LayoutBlockFlow::createLineBoxes(LayoutObject* obj, const LineInf o& lineInfo, InlineBox* childBox) 103 InlineFlowBox* LayoutBlockFlow::createLineBoxes(LayoutObject* obj, const LineInf o& lineInfo, InlineBox* childBox)
104 { 104 {
105 // See if we have an unconstructed line box for this object that is also 105 // See if we have an unconstructed line box for this object that is also
106 // the last item on the line. 106 // the last item on the line.
107 unsigned lineDepth = 1; 107 unsigned lineDepth = 1;
108 InlineFlowBox* parentBox = 0; 108 InlineFlowBox* parentBox = 0;
109 InlineFlowBox* result = 0; 109 InlineFlowBox* result = 0;
110 bool hasDefaultLineBoxContain = style()->lineBoxContain() == LayoutStyle::in itialLineBoxContain(); 110 bool hasDefaultLineBoxContain = style()->lineBoxContain() == ComputedStyle:: initialLineBoxContain();
111 do { 111 do {
112 ASSERT_WITH_SECURITY_IMPLICATION(obj->isLayoutInline() || obj == this); 112 ASSERT_WITH_SECURITY_IMPLICATION(obj->isLayoutInline() || obj == this);
113 113
114 LayoutInline* inlineFlow = (obj != this) ? toLayoutInline(obj) : 0; 114 LayoutInline* inlineFlow = (obj != this) ? toLayoutInline(obj) : 0;
115 115
116 // Get the last box we made for this render object. 116 // Get the last box we made for this render object.
117 parentBox = inlineFlow ? inlineFlow->lastLineBox() : toLayoutBlock(obj)- >lastLineBox(); 117 parentBox = inlineFlow ? inlineFlow->lastLineBox() : toLayoutBlock(obj)- >lastLineBox();
118 118
119 // If this box or its ancestor is constructed then it is from a previous line, and we need 119 // If this box or its ancestor is constructed then it is from a previous line, and we need
120 // to make a new box for our line. If this box or its ancestor is uncon structed but it has 120 // to make a new box for our line. If this box or its ancestor is uncon structed but it has
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 removeFloatingObjectsBelow(lastFloatFromPreviousLine, oldLogicalHeight); 781 removeFloatingObjectsBelow(lastFloatFromPreviousLine, oldLogicalHeight);
782 setLogicalHeight(newLogicalHeight); 782 setLogicalHeight(newLogicalHeight);
783 resolver.setPositionIgnoringNestedIsolates(oldEnd); 783 resolver.setPositionIgnoringNestedIsolates(oldEnd);
784 return oldEnd; 784 return oldEnd;
785 } 785 }
786 786
787 void LayoutBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, 787 void LayoutBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
788 InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, 788 InlineBidiResolver& resolver, const InlineIterator& cleanLineStart,
789 const BidiStatus& cleanLineBidiStatus) 789 const BidiStatus& cleanLineBidiStatus)
790 { 790 {
791 const LayoutStyle& styleToUse = styleRef(); 791 const ComputedStyle& styleToUse = styleRef();
792 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated (); 792 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated ();
793 LineMidpointState& lineMidpointState = resolver.midpointState(); 793 LineMidpointState& lineMidpointState = resolver.midpointState();
794 InlineIterator endOfLine = resolver.position(); 794 InlineIterator endOfLine = resolver.position();
795 bool checkForEndLineMatch = layoutState.endLine(); 795 bool checkForEndLineMatch = layoutState.endLine();
796 LayoutTextInfo renderTextInfo; 796 LayoutTextInfo renderTextInfo;
797 VerticalPositionCache verticalPositionCache; 797 VerticalPositionCache verticalPositionCache;
798 798
799 LineBreaker lineBreaker(this); 799 LineBreaker lineBreaker(this);
800 800
801 while (!endOfLine.atEnd()) { 801 while (!endOfLine.atEnd()) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1149
1150 static LayoutUnit getBPMWidth(LayoutUnit childValue, Length cssUnit) 1150 static LayoutUnit getBPMWidth(LayoutUnit childValue, Length cssUnit)
1151 { 1151 {
1152 if (cssUnit.type() != Auto) 1152 if (cssUnit.type() != Auto)
1153 return (cssUnit.isFixed() ? static_cast<LayoutUnit>(cssUnit.value()) : c hildValue); 1153 return (cssUnit.isFixed() ? static_cast<LayoutUnit>(cssUnit.value()) : c hildValue);
1154 return LayoutUnit(); 1154 return LayoutUnit();
1155 } 1155 }
1156 1156
1157 static LayoutUnit getBorderPaddingMargin(const LayoutBoxModelObject& child, bool endOfInline) 1157 static LayoutUnit getBorderPaddingMargin(const LayoutBoxModelObject& child, bool endOfInline)
1158 { 1158 {
1159 const LayoutStyle& childStyle = child.styleRef(); 1159 const ComputedStyle& childStyle = child.styleRef();
1160 if (endOfInline) { 1160 if (endOfInline) {
1161 return getBPMWidth(child.marginEnd(), childStyle.marginEnd()) + 1161 return getBPMWidth(child.marginEnd(), childStyle.marginEnd()) +
1162 getBPMWidth(child.paddingEnd(), childStyle.paddingEnd()) + 1162 getBPMWidth(child.paddingEnd(), childStyle.paddingEnd()) +
1163 child.borderEnd(); 1163 child.borderEnd();
1164 } 1164 }
1165 return getBPMWidth(child.marginStart(), childStyle.marginStart()) + 1165 return getBPMWidth(child.marginStart(), childStyle.marginStart()) +
1166 getBPMWidth(child.paddingStart(), childStyle.paddingStart()) + 1166 getBPMWidth(child.paddingStart(), childStyle.paddingStart()) +
1167 child.borderStart(); 1167 child.borderStart();
1168 } 1168 }
1169 1169
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 return LayoutUnit::fromFloatCeil(value); 1207 return LayoutUnit::fromFloatCeil(value);
1208 } 1208 }
1209 1209
1210 // FIXME: This function should be broken into something less monolithic. 1210 // FIXME: This function should be broken into something less monolithic.
1211 // FIXME: The main loop here is very similar to LineBreaker::nextSegmentBreak. T hey can probably reuse code. 1211 // FIXME: The main loop here is very similar to LineBreaker::nextSegmentBreak. T hey can probably reuse code.
1212 void LayoutBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical Width, LayoutUnit& maxLogicalWidth) 1212 void LayoutBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical Width, LayoutUnit& maxLogicalWidth)
1213 { 1213 {
1214 FloatWillBeLayoutUnit inlineMax; 1214 FloatWillBeLayoutUnit inlineMax;
1215 FloatWillBeLayoutUnit inlineMin; 1215 FloatWillBeLayoutUnit inlineMin;
1216 1216
1217 const LayoutStyle& styleToUse = styleRef(); 1217 const ComputedStyle& styleToUse = styleRef();
1218 LayoutBlock* containingBlock = this->containingBlock(); 1218 LayoutBlock* containingBlock = this->containingBlock();
1219 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : L ayoutUnit(); 1219 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : L ayoutUnit();
1220 1220
1221 // If we are at the start of a line, we want to ignore all white-space. 1221 // If we are at the start of a line, we want to ignore all white-space.
1222 // Also strip spaces if we previously had text that ended in a trailing spac e. 1222 // Also strip spaces if we previously had text that ended in a trailing spac e.
1223 bool stripFrontSpaces = true; 1223 bool stripFrontSpaces = true;
1224 LayoutObject* trailingSpaceChild = 0; 1224 LayoutObject* trailingSpaceChild = 0;
1225 1225
1226 // Firefox and Opera will allow a table cell to grow to fit an image inside it under 1226 // Firefox and Opera will allow a table cell to grow to fit an image inside it under
1227 // very specific cirucumstances (in order to match common WinIE renderings). 1227 // very specific cirucumstances (in order to match common WinIE renderings).
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 // If the text string starts with whitespace, then we need to go ahe ad and 1275 // If the text string starts with whitespace, then we need to go ahe ad and
1276 // terminate our current line (unless we're already in a whitespace stripping 1276 // terminate our current line (unless we're already in a whitespace stripping
1277 // mode. 1277 // mode.
1278 // 1278 //
1279 // If the text string has a breakable character in the middle, but d idn't start 1279 // If the text string has a breakable character in the middle, but d idn't start
1280 // with whitespace, then we add the width of the first non-breakable run and 1280 // with whitespace, then we add the width of the first non-breakable run and
1281 // then end the current line. We then need to use the intermediate m in/max width 1281 // then end the current line. We then need to use the intermediate m in/max width
1282 // values (if any of them are larger than our current min/max). We t hen look at 1282 // values (if any of them are larger than our current min/max). We t hen look at
1283 // the width of the last non-breakable run and use that to start a n ew line 1283 // the width of the last non-breakable run and use that to start a n ew line
1284 // (unless we end in whitespace). 1284 // (unless we end in whitespace).
1285 const LayoutStyle& childStyle = child->styleRef(); 1285 const ComputedStyle& childStyle = child->styleRef();
1286 FloatWillBeLayoutUnit childMin; 1286 FloatWillBeLayoutUnit childMin;
1287 FloatWillBeLayoutUnit childMax; 1287 FloatWillBeLayoutUnit childMax;
1288 1288
1289 if (!child->isText()) { 1289 if (!child->isText()) {
1290 // Case (1) and (2). Inline replaced and inline flow elements. 1290 // Case (1) and (2). Inline replaced and inline flow elements.
1291 if (child->isLayoutInline()) { 1291 if (child->isLayoutInline()) {
1292 // Add in padding/border/margin from the appropriate side of 1292 // Add in padding/border/margin from the appropriate side of
1293 // the element. 1293 // the element.
1294 FloatWillBeLayoutUnit bpm = getBorderPaddingMargin(toLayoutI nline(*child), childIterator.endOfInline); 1294 FloatWillBeLayoutUnit bpm = getBorderPaddingMargin(toLayoutI nline(*child), childIterator.endOfInline);
1295 childMin += bpm; 1295 childMin += bpm;
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2052 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2053 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2053 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2054 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2054 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2055 2055
2056 if (!style()->isLeftToRightDirection()) 2056 if (!style()->isLeftToRightDirection())
2057 return logicalWidth() - logicalLeft; 2057 return logicalWidth() - logicalLeft;
2058 return logicalLeft; 2058 return logicalLeft;
2059 } 2059 }
2060 2060
2061 } 2061 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698