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

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

Issue 1647313003: Continue converting to explicit LayoutUnit constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicitContstructors
Patch Set: Add TODO 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) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return virtualLogicalHeight(); 143 return virtualLogicalHeight();
144 144
145 if (lineLayoutItem().isText()) 145 if (lineLayoutItem().isText())
146 return m_bitfields.isText() ? LayoutUnit(lineLayoutItem().style(isFirstL ineStyle())->fontMetrics().height()) : LayoutUnit(); 146 return m_bitfields.isText() ? LayoutUnit(lineLayoutItem().style(isFirstL ineStyle())->fontMetrics().height()) : LayoutUnit();
147 if (lineLayoutItem().isBox() && parent()) 147 if (lineLayoutItem().isBox() && parent())
148 return isHorizontal() ? toLayoutBox(layoutObject()).size().height() : to LayoutBox(layoutObject()).size().width(); 148 return isHorizontal() ? toLayoutBox(layoutObject()).size().height() : to LayoutBox(layoutObject()).size().width();
149 149
150 ASSERT(isInlineFlowBox()); 150 ASSERT(isInlineFlowBox());
151 LineLayoutBoxModel flowObject = boxModelObject(); 151 LineLayoutBoxModel flowObject = boxModelObject();
152 const FontMetrics& fontMetrics = lineLayoutItem().style(isFirstLineStyle())- >fontMetrics(); 152 const FontMetrics& fontMetrics = lineLayoutItem().style(isFirstLineStyle())- >fontMetrics();
153 LayoutUnit result = fontMetrics.height(); 153 LayoutUnit result(fontMetrics.height());
154 if (parent()) 154 if (parent())
155 result += flowObject.borderAndPaddingLogicalHeight(); 155 result += flowObject.borderAndPaddingLogicalHeight();
156 return result; 156 return result;
157 } 157 }
158 158
159 int InlineBox::baselinePosition(FontBaseline baselineType) const 159 int InlineBox::baselinePosition(FontBaseline baselineType) const
160 { 160 {
161 return boxModelObject().baselinePosition(baselineType, m_bitfields.firstLine (), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); 161 return boxModelObject().baselinePosition(baselineType, m_bitfields.firstLine (), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine);
162 } 162 }
163 163
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 IntRect boxRect(left(), 0, m_logicalWidth, 10); 314 IntRect boxRect(left(), 0, m_logicalWidth, 10);
315 IntRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, ellipsi sWidth, 10); 315 IntRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, ellipsi sWidth, 10);
316 return !(boxRect.intersects(ellipsisRect)); 316 return !(boxRect.intersects(ellipsisRect));
317 } 317 }
318 318
319 LayoutUnit InlineBox::placeEllipsisBox(bool, LayoutUnit, LayoutUnit, LayoutUnit, LayoutUnit& truncatedWidth, bool&) 319 LayoutUnit InlineBox::placeEllipsisBox(bool, LayoutUnit, LayoutUnit, LayoutUnit, LayoutUnit& truncatedWidth, bool&)
320 { 320 {
321 // Use -1 to mean "we didn't set the position." 321 // Use -1 to mean "we didn't set the position."
322 truncatedWidth += logicalWidth(); 322 truncatedWidth += logicalWidth();
323 return -1; 323 return LayoutUnit(-1);
324 } 324 }
325 325
326 void InlineBox::clearKnownToHaveNoOverflow() 326 void InlineBox::clearKnownToHaveNoOverflow()
327 { 327 {
328 m_bitfields.setKnownToHaveNoOverflow(false); 328 m_bitfields.setKnownToHaveNoOverflow(false);
329 if (parent() && parent()->knownToHaveNoOverflow()) 329 if (parent() && parent()->knownToHaveNoOverflow())
330 parent()->clearKnownToHaveNoOverflow(); 330 parent()->clearKnownToHaveNoOverflow();
331 } 331 }
332 332
333 LayoutPoint InlineBox::locationIncludingFlipping() const 333 LayoutPoint InlineBox::locationIncludingFlipping() const
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 410
411 void showLineTree(const blink::InlineBox* b) 411 void showLineTree(const blink::InlineBox* b)
412 { 412 {
413 if (b) 413 if (b)
414 b->showLineTreeForThis(); 414 b->showLineTreeForThis();
415 else 415 else
416 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n"); 416 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n");
417 } 417 }
418 418
419 #endif 419 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698