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

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

Issue 1653673002: Even more explicit LayoutUnit conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moarConstructors
Patch Set: address comments 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 * 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 426 }
427 427
428 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru n, LayoutText* layoutText, LayoutUnit xPos, const LineInfo& lineInfo, 428 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru n, LayoutText* layoutText, LayoutUnit xPos, const LineInfo& lineInfo,
429 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& ver ticalPositionCache, WordMeasurements& wordMeasurements) 429 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& ver ticalPositionCache, WordMeasurements& wordMeasurements)
430 { 430 {
431 HashSet<const SimpleFontData*> fallbackFonts; 431 HashSet<const SimpleFontData*> fallbackFonts;
432 GlyphOverflow glyphOverflow; 432 GlyphOverflow glyphOverflow;
433 433
434 const Font& font = layoutText->style(lineInfo.isFirstLine())->font(); 434 const Font& font = layoutText->style(lineInfo.isFirstLine())->font();
435 435
436 LayoutUnit hyphenWidth = 0; 436 LayoutUnit hyphenWidth;
437 if (toInlineTextBox(run->m_box)->hasHyphen()) 437 if (toInlineTextBox(run->m_box)->hasHyphen())
438 hyphenWidth = layoutText->hyphenWidth(font, run->direction()); 438 hyphenWidth = layoutText->hyphenWidth(font, run->direction());
439 439
440 float measuredWidth = 0; 440 float measuredWidth = 0;
441 FloatRect glyphBounds; 441 FloatRect glyphBounds;
442 442
443 bool kerningIsEnabled = font.fontDescription().typesettingFeatures() & Kerni ng; 443 bool kerningIsEnabled = font.fontDescription().typesettingFeatures() & Kerni ng;
444 444
445 #if OS(MACOSX) 445 #if OS(MACOSX)
446 // FIXME: Having any font feature settings enabled can lead to selection gap s on 446 // FIXME: Having any font feature settings enabled can lead to selection gap s on
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 905
906 bidiRuns.deleteRuns(); 906 bidiRuns.deleteRuns();
907 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla ced by an ASSERT (or just removed). 907 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla ced by an ASSERT (or just removed).
908 908
909 if (lineBox) { 909 if (lineBox) {
910 lineBox->setLineBreakInfo(endOfLine.object(), endOfLine.offset() , resolver.status()); 910 lineBox->setLineBreakInfo(endOfLine.object(), endOfLine.offset() , resolver.status());
911 if (layoutState.usesPaintInvalidationBounds()) 911 if (layoutState.usesPaintInvalidationBounds())
912 layoutState.updatePaintInvalidationRangeFromBox(lineBox); 912 layoutState.updatePaintInvalidationRangeFromBox(lineBox);
913 913
914 if (paginated) { 914 if (paginated) {
915 LayoutUnit adjustment = 0; 915 LayoutUnit adjustment;
916 adjustLinePositionForPagination(*lineBox, adjustment); 916 adjustLinePositionForPagination(*lineBox, adjustment);
917 if (adjustment) { 917 if (adjustment) {
918 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o ldLogicalHeight, layoutState.lineInfo().isFirstLine() ? IndentText : DoNotIndent Text); 918 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o ldLogicalHeight, layoutState.lineInfo().isFirstLine() ? IndentText : DoNotIndent Text);
919 lineBox->moveInBlockDirection(adjustment); 919 lineBox->moveInBlockDirection(adjustment);
920 if (layoutState.usesPaintInvalidationBounds()) 920 if (layoutState.usesPaintInvalidationBounds())
921 layoutState.updatePaintInvalidationRangeFromBox(line Box); 921 layoutState.updatePaintInvalidationRangeFromBox(line Box);
922 922
923 if (availableLogicalWidthForLine(oldLogicalHeight + adju stment, layoutState.lineInfo().isFirstLine() ? IndentText: DoNotIndentText) != o ldLineWidth) { 923 if (availableLogicalWidthForLine(oldLogicalHeight + adju stment, layoutState.lineInfo().isFirstLine() ? IndentText: DoNotIndentText) != o ldLineWidth) {
924 // We have to delete this line, remove all floats th at got added, and let line layout re-run. 924 // We have to delete this line, remove all floats th at got added, and let line layout re-run.
925 lineBox->deleteLine(); 925 lineBox->deleteLine();
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt ate, InlineBidiResolver& resolver) 1633 RootInlineBox* LayoutBlockFlow::determineStartPosition(LineLayoutState& layoutSt ate, InlineBidiResolver& resolver)
1634 { 1634 {
1635 RootInlineBox* curr = nullptr; 1635 RootInlineBox* curr = nullptr;
1636 RootInlineBox* last = nullptr; 1636 RootInlineBox* last = nullptr;
1637 RootInlineBox* firstLineBoxWithBreakAndClearance = 0; 1637 RootInlineBox* firstLineBoxWithBreakAndClearance = 0;
1638 1638
1639 // FIXME: This entire float-checking block needs to be broken into a new fun ction. 1639 // FIXME: This entire float-checking block needs to be broken into a new fun ction.
1640 if (!layoutState.isFullLayout()) { 1640 if (!layoutState.isFullLayout()) {
1641 // Paginate all of the clean lines. 1641 // Paginate all of the clean lines.
1642 bool paginated = view()->layoutState() && view()->layoutState()->isPagin ated(); 1642 bool paginated = view()->layoutState() && view()->layoutState()->isPagin ated();
1643 LayoutUnit paginationDelta = 0; 1643 LayoutUnit paginationDelta;
1644 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR ootBox()) { 1644 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextR ootBox()) {
1645 if (paginated) { 1645 if (paginated) {
1646 paginationDelta -= curr->paginationStrut(); 1646 paginationDelta -= curr->paginationStrut();
1647 adjustLinePositionForPagination(*curr, paginationDelta); 1647 adjustLinePositionForPagination(*curr, paginationDelta);
1648 if (paginationDelta) { 1648 if (paginationDelta) {
1649 if (containsFloats() || !layoutState.floats().isEmpty()) { 1649 if (containsFloats() || !layoutState.floats().isEmpty()) {
1650 // FIXME: Do better eventually. For now if we ever shif t because of pagination and floats are present just go to a full layout. 1650 // FIXME: Do better eventually. For now if we ever shif t because of pagination and floats are present just go to a full layout.
1651 layoutState.markForFullLayout(); 1651 layoutState.markForFullLayout();
1652 break; 1652 break;
1653 } 1653 }
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 if (!line || !line->isFirstLineStyle()) 2107 if (!line || !line->isFirstLineStyle())
2108 return reason; 2108 return reason;
2109 // It's the RootInlineBox that paints the ::first-line background. Note that since it may be 2109 // It's the RootInlineBox that paints the ::first-line background. Note that since it may be
2110 // expensive to figure out if the first line is affected by any ::first-line selectors at all, 2110 // expensive to figure out if the first line is affected by any ::first-line selectors at all,
2111 // we just invalidate it unconditionally, since that's typically cheaper. 2111 // we just invalidate it unconditionally, since that's typically cheaper.
2112 invalidateDisplayItemClient(*line); 2112 invalidateDisplayItemClient(*line);
2113 return reason; 2113 return reason;
2114 } 2114 }
2115 2115
2116 } // namespace blink 2116 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698