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

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

Issue 2765353004: Avoid inline capacity of WordMeasurements (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | no next file » | 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. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All right reserved. 4 * All right reserved.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 LayoutTextInfo layoutTextInfo; 1080 LayoutTextInfo layoutTextInfo;
1081 VerticalPositionCache verticalPositionCache; 1081 VerticalPositionCache verticalPositionCache;
1082 1082
1083 // Pagination may require us to delete and re-create a line due to floats. 1083 // Pagination may require us to delete and re-create a line due to floats.
1084 // When this happens, 1084 // When this happens,
1085 // we need to store the pagination strut in the meantime. 1085 // we need to store the pagination strut in the meantime.
1086 LayoutUnit paginationStrutFromDeletedLine; 1086 LayoutUnit paginationStrutFromDeletedLine;
1087 1087
1088 LineBreaker lineBreaker(LineLayoutBlockFlow(this)); 1088 LineBreaker lineBreaker(LineLayoutBlockFlow(this));
1089 1089
1090 // We avoid inline capacity to save the stack space.
1091 WordMeasurements wordMeasurements;
1092 wordMeasurements.reserveInitialCapacity(64);
1093
1090 while (!endOfLine.atEnd()) { 1094 while (!endOfLine.atEnd()) {
1091 // The runs from the previous line should have been cleaned up. 1095 // The runs from the previous line should have been cleaned up.
1092 ASSERT(!resolver.runs().runCount()); 1096 ASSERT(!resolver.runs().runCount());
1093 1097
1094 // FIXME: Is this check necessary before the first iteration or can it be 1098 // FIXME: Is this check necessary before the first iteration or can it be
1095 // moved to the end? 1099 // moved to the end?
1096 if (layoutState.endLine()) { 1100 if (layoutState.endLine()) {
1097 layoutState.setEndLineMatched(layoutState.endLineMatched() || 1101 layoutState.setEndLineMatched(layoutState.endLineMatched() ||
1098 matchedEndLine(layoutState, resolver, 1102 matchedEndLine(layoutState, resolver,
1099 cleanLineStart, 1103 cleanLineStart,
1100 cleanLineBidiStatus)); 1104 cleanLineBidiStatus));
1101 if (layoutState.endLineMatched()) { 1105 if (layoutState.endLineMatched()) {
1102 resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0), 1106 resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0),
1103 0); 1107 0);
1104 break; 1108 break;
1105 } 1109 }
1106 } 1110 }
1107 1111
1108 lineMidpointState.reset(); 1112 lineMidpointState.reset();
1109 1113
1110 layoutState.lineInfo().setEmpty(true); 1114 layoutState.lineInfo().setEmpty(true);
1111 layoutState.lineInfo().resetRunsFromLeadingWhitespace(); 1115 layoutState.lineInfo().resetRunsFromLeadingWhitespace();
1112 1116
1113 const InlineIterator previousEndofLine = endOfLine; 1117 const InlineIterator previousEndofLine = endOfLine;
1114 bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly(); 1118 bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly();
1115 FloatingObject* lastFloatFromPreviousLine = 1119 FloatingObject* lastFloatFromPreviousLine =
1116 (containsFloats()) ? m_floatingObjects->set().back().get() : 0; 1120 (containsFloats()) ? m_floatingObjects->set().back().get() : 0;
1117 1121
1118 WordMeasurements wordMeasurements; 1122 wordMeasurements.clear();
1119 endOfLine = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), 1123 endOfLine = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(),
1120 layoutTextInfo, wordMeasurements); 1124 layoutTextInfo, wordMeasurements);
1121 layoutTextInfo.m_lineBreakIterator.resetPriorContext(); 1125 layoutTextInfo.m_lineBreakIterator.resetPriorContext();
1122 if (resolver.position().atEnd()) { 1126 if (resolver.position().atEnd()) {
1123 // FIXME: We shouldn't be creating any runs in nextLineBreak to begin 1127 // FIXME: We shouldn't be creating any runs in nextLineBreak to begin
1124 // with! Once BidiRunList is separated from BidiResolver this will not be 1128 // with! Once BidiRunList is separated from BidiResolver this will not be
1125 // needed. 1129 // needed.
1126 resolver.runs().deleteRuns(); 1130 resolver.runs().deleteRuns();
1127 resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced 1131 resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced
1128 // by an ASSERT (or just removed). 1132 // by an ASSERT (or just removed).
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 2591
2588 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { 2592 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const {
2589 // LayoutBlockFlow is in charge of paint invalidation of the first line. 2593 // LayoutBlockFlow is in charge of paint invalidation of the first line.
2590 if (firstLineBox()) 2594 if (firstLineBox())
2591 return false; 2595 return false;
2592 2596
2593 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize(); 2597 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize();
2594 } 2598 }
2595 2599
2596 } // namespace blink 2600 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698