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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/LineWidth.cpp

Issue 1660863002: Force all LayoutUnit construction to be explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix LayoutRectTest.cpp Created 4 years, 10 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) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 while (true) { 150 while (true) {
151 newLineWidth = availableWidthAtOffset(m_block, newLineTop, indentText(), newLineLeft, newLineRight, lineHeight); 151 newLineWidth = availableWidthAtOffset(m_block, newLineTop, indentText(), newLineLeft, newLineRight, lineHeight);
152 if (newLineWidth >= m_uncommittedWidth) 152 if (newLineWidth >= m_uncommittedWidth)
153 break; 153 break;
154 154
155 if (newLineTop >= floatLogicalBottom) 155 if (newLineTop >= floatLogicalBottom)
156 break; 156 break;
157 157
158 newLineTop++; 158 newLineTop++;
159 } 159 }
160 updateLineDimension(newLineTop, newLineWidth, newLineLeft, newLineRight); 160 updateLineDimension(newLineTop, LayoutUnit(newLineWidth), newLineLeft, newLi neRight);
161 } 161 }
162 162
163 void LineWidth::fitBelowFloats(bool isFirstLine) 163 void LineWidth::fitBelowFloats(bool isFirstLine)
164 { 164 {
165 ASSERT(!m_committedWidth); 165 ASSERT(!m_committedWidth);
166 ASSERT(!fitsOnLine()); 166 ASSERT(!fitsOnLine());
167 m_block.positionNewFloats(this); 167 m_block.positionNewFloats(this);
168 168
169 LayoutUnit floatLogicalBottom; 169 LayoutUnit floatLogicalBottom;
170 LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight(); 170 LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight();
171 float newLineWidth = m_availableWidth; 171 float newLineWidth = m_availableWidth;
172 float newLineLeft = m_left; 172 float newLineLeft = m_left;
173 float newLineRight = m_right; 173 float newLineRight = m_right;
174 174
175 FloatingObject* lastFloatFromPreviousLine = m_block.lastFloatFromPreviousLin e(); 175 FloatingObject* lastFloatFromPreviousLine = m_block.lastFloatFromPreviousLin e();
176 if (lastFloatFromPreviousLine && lastFloatFromPreviousLine->layoutObject ()->shapeOutsideInfo()) 176 if (lastFloatFromPreviousLine && lastFloatFromPreviousLine->layoutObject ()->shapeOutsideInfo())
177 return wrapNextToShapeOutside(isFirstLine); 177 return wrapNextToShapeOutside(isFirstLine);
178 178
179 while (true) { 179 while (true) {
180 floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogica lBottom); 180 floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogica lBottom);
181 if (floatLogicalBottom <= lastFloatLogicalBottom) 181 if (floatLogicalBottom <= lastFloatLogicalBottom)
182 break; 182 break;
183 183
184 newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, inden tText(), newLineLeft, newLineRight); 184 newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, inden tText(), newLineLeft, newLineRight);
185 lastFloatLogicalBottom = floatLogicalBottom; 185 lastFloatLogicalBottom = floatLogicalBottom;
186 186
187 if (newLineWidth >= m_uncommittedWidth) 187 if (newLineWidth >= m_uncommittedWidth)
188 break; 188 break;
189 } 189 }
190 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi neRight); 190 updateLineDimension(lastFloatLogicalBottom, LayoutUnit(newLineWidth), newLin eLeft, newLineRight);
191 } 191 }
192 192
193 void LineWidth::computeAvailableWidthFromLeftAndRight() 193 void LineWidth::computeAvailableWidthFromLeftAndRight()
194 { 194 {
195 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; 195 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth;
196 } 196 }
197 197
198 } // namespace blink 198 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698