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

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

Issue 1583783002: Use IndentTextOrNot instead of a bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@568851-2
Patch Set: Created 4 years, 11 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return false; 207 return false;
208 208
209 if (!shouldCollapseWhiteSpace(it.object().styleRef(), lineInfo, whitespacePo sition) || it.object().isBR()) 209 if (!shouldCollapseWhiteSpace(it.object().styleRef(), lineInfo, whitespacePo sition) || it.object().isBR())
210 return true; 210 return true;
211 211
212 UChar current = it.current(); 212 UChar current = it.current();
213 bool notJustWhitespace = current != spaceCharacter && current != tabulationC haracter && current != softHyphenCharacter && (current != newlineCharacter || it .object().preservesNewline()); 213 bool notJustWhitespace = current != spaceCharacter && current != tabulationC haracter && current != softHyphenCharacter && (current != newlineCharacter || it .object().preservesNewline());
214 return notJustWhitespace || isEmptyInline(it.object()); 214 return notJustWhitespace || isEmptyInline(it.object());
215 } 215 }
216 216
217 inline void setStaticPositions(LineLayoutBlockFlow block, LineLayoutBox child, b ool shouldIndentText) 217 inline void setStaticPositions(LineLayoutBlockFlow block, LineLayoutBox child, I ndentTextOrNot shouldIndentText)
218 { 218 {
219 ASSERT(child.isOutOfFlowPositioned()); 219 ASSERT(child.isOutOfFlowPositioned());
220 // FIXME: The math here is actually not really right. It's a best-guess appr oximation that 220 // FIXME: The math here is actually not really right. It's a best-guess appr oximation that
221 // will work for the common cases 221 // will work for the common cases
222 LineLayoutItem containerBlock = child.container(); 222 LineLayoutItem containerBlock = child.container();
223 LayoutUnit blockHeight = block.logicalHeight(); 223 LayoutUnit blockHeight = block.logicalHeight();
224 if (containerBlock.isLayoutInline()) { 224 if (containerBlock.isLayoutInline()) {
225 // A relative positioned inline encloses us. In this case, we also have to determine our 225 // A relative positioned inline encloses us. In this case, we also have to determine our
226 // position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned 226 // position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned
227 // inline so that we can obtain the value later. 227 // inline so that we can obtain the value later.
(...skipping 12 matching lines...) Expand all
240 // line boxes even for containers that may ultimately collapse away. Otherwise w e'll never get positioned 240 // line boxes even for containers that may ultimately collapse away. Otherwise w e'll never get positioned
241 // elements quite right. In other words, we need to build this function's work i nto the normal line 241 // elements quite right. In other words, we need to build this function's work i nto the normal line
242 // object iteration process. 242 // object iteration process.
243 // NB. this function will insert any floating elements that would otherwise 243 // NB. this function will insert any floating elements that would otherwise
244 // be skipped but it will not position them. 244 // be skipped but it will not position them.
245 inline void BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, co nst LineInfo& lineInfo) 245 inline void BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, co nst LineInfo& lineInfo)
246 { 246 {
247 while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhi tespace)) { 247 while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhi tespace)) {
248 LineLayoutItem item = iterator.object(); 248 LineLayoutItem item = iterator.object();
249 if (item.isOutOfFlowPositioned()) 249 if (item.isOutOfFlowPositioned())
250 setStaticPositions(m_block, LineLayoutBox(item), false); 250 setStaticPositions(m_block, LineLayoutBox(item), DoNotIndentText);
251 else if (item.isFloating()) 251 else if (item.isFloating())
252 m_block.insertFloatingObject(LineLayoutBox(item)); 252 m_block.insertFloatingObject(LineLayoutBox(item));
253 iterator.increment(); 253 iterator.increment();
254 } 254 }
255 } 255 }
256 256
257 inline void BreakingContext::initializeForCurrentObject() 257 inline void BreakingContext::initializeForCurrentObject()
258 { 258 {
259 m_currentStyle = m_current.object().style(); 259 m_currentStyle = m_current.object().style();
260 m_nextObject = bidiNextSkippingEmptyInlines(m_block, m_current.object()); 260 m_nextObject = bidiNextSkippingEmptyInlines(m_block, m_current.object());
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 980
981 if (style.textIndentType() == TextIndentHanging) 981 if (style.textIndentType() == TextIndentHanging)
982 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText; 982 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText;
983 983
984 return shouldIndentText; 984 return shouldIndentText;
985 } 985 }
986 986
987 } 987 }
988 988
989 #endif // BreakingContextInlineHeaders_h 989 #endif // BreakingContextInlineHeaders_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698