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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h

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) 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 * Copyright (C) 2013 Adobe Systems Incorporated. 5 * Copyright (C) 2013 Adobe Systems Incorporated.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 { 333 {
334 if (!child || (child.isText() && !LineLayoutText(child).textLength())) 334 if (!child || (child.isText() && !LineLayoutText(child).textLength()))
335 return true; 335 return true;
336 checkSide = false; 336 checkSide = false;
337 return checkSide; 337 return checkSide;
338 } 338 }
339 339
340 inline LayoutUnit inlineLogicalWidthFromAncestorsIfNeeded(LineLayoutItem child, bool start = true, bool end = true) 340 inline LayoutUnit inlineLogicalWidthFromAncestorsIfNeeded(LineLayoutItem child, bool start = true, bool end = true)
341 { 341 {
342 unsigned lineDepth = 1; 342 unsigned lineDepth = 1;
343 LayoutUnit extraWidth = 0; 343 LayoutUnit extraWidth;
344 LineLayoutItem parent = child.parent(); 344 LineLayoutItem parent = child.parent();
345 while (parent.isLayoutInline() && lineDepth++ < cMaxLineDepth) { 345 while (parent.isLayoutInline() && lineDepth++ < cMaxLineDepth) {
346 LineLayoutInline parentAsLayoutInline(parent); 346 LineLayoutInline parentAsLayoutInline(parent);
347 if (!isEmptyInline(parentAsLayoutInline)) { 347 if (!isEmptyInline(parentAsLayoutInline)) {
348 if (start && shouldAddBorderPaddingMargin(child.previousSibling(), s tart)) 348 if (start && shouldAddBorderPaddingMargin(child.previousSibling(), s tart))
349 extraWidth += borderPaddingMarginStart(parentAsLayoutInline); 349 extraWidth += borderPaddingMarginStart(parentAsLayoutInline);
350 if (end && shouldAddBorderPaddingMargin(child.nextSibling(), end)) 350 if (end && shouldAddBorderPaddingMargin(child.nextSibling(), end))
351 extraWidth += borderPaddingMarginEnd(parentAsLayoutInline); 351 extraWidth += borderPaddingMarginEnd(parentAsLayoutInline);
352 if (!start && !end) 352 if (!start && !end)
353 return extraWidth; 353 return extraWidth;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir ection) 526 ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir ection)
527 { 527 {
528 return direction == WTF::Unicode::RightToLeft 528 return direction == WTF::Unicode::RightToLeft
529 || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR; 529 || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR;
530 } 530 }
531 531
532 ALWAYS_INLINE float textWidth(LineLayoutText text, unsigned from, unsigned len, const Font& font, float xPos, bool collapseWhiteSpace, HashSet<const SimpleFontD ata*>* fallbackFonts = nullptr, FloatRect* glyphBounds = nullptr) 532 ALWAYS_INLINE float textWidth(LineLayoutText text, unsigned from, unsigned len, const Font& font, float xPos, bool collapseWhiteSpace, HashSet<const SimpleFontD ata*>* fallbackFonts = nullptr, FloatRect* glyphBounds = nullptr)
533 { 533 {
534 if ((!from && len == text.textLength()) || text.style()->hasTextCombine()) 534 if ((!from && len == text.textLength()) || text.style()->hasTextCombine())
535 return text.width(from, len, font, xPos, text.style()->direction(), fall backFonts, glyphBounds); 535 return text.width(from, len, font, LayoutUnit(xPos), text.style()->direc tion(), fallbackFonts, glyphBounds);
536 536
537 TextRun run = constructTextRun(font, text, from, len, text.styleRef()); 537 TextRun run = constructTextRun(font, text, from, len, text.styleRef());
538 run.setTabSize(!collapseWhiteSpace, text.style()->tabSize()); 538 run.setTabSize(!collapseWhiteSpace, text.style()->tabSize());
539 run.setXPos(xPos); 539 run.setXPos(xPos);
540 return font.width(run, fallbackFonts, glyphBounds); 540 return font.width(run, fallbackFonts, glyphBounds);
541 } 541 }
542 542
543 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool & hyphenated) 543 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool & hyphenated)
544 { 544 {
545 if (!m_current.offset()) 545 if (!m_current.offset())
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 980
981 if (style.textIndentType() == TextIndentHanging) 981 if (style.textIndentType() == TextIndentHanging)
982 indentText = indentText == IndentText ? DoNotIndentText : IndentText; 982 indentText = indentText == IndentText ? DoNotIndentText : IndentText;
983 983
984 return indentText; 984 return indentText;
985 } 985 }
986 986
987 } // namespace blink 987 } // namespace blink
988 988
989 #endif // BreakingContextInlineHeaders_h 989 #endif // BreakingContextInlineHeaders_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698