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

Side by Side Diff: Source/core/rendering/line/BreakingContextInlineHeaders.h

Issue 351213002: Change RenderObject::style(bool) to accept an enum instead (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Renamed enum to OwnOrFirstLineStyle, rebased and got rid of duplicate state on the stack in RootInl… Created 6 years, 5 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 | « Source/core/rendering/RootInlineBox.cpp ('k') | Source/core/rendering/line/LineWidth.cpp » ('j') | 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. 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // If a space (U+0020) at the end of a line has 'white-space' set to 'normal ', 'nowrap', or 'pre-line', it is also removed. 159 // If a space (U+0020) at the end of a line has 'white-space' set to 'normal ', 'nowrap', or 'pre-line', it is also removed.
160 // If spaces (U+0020) or tabs (U+0009) at the end of a line have 'white-spac e' set to 'pre-wrap', UAs may visually collapse them. 160 // If spaces (U+0020) or tabs (U+0009) at the end of a line have 'white-spac e' set to 'pre-wrap', UAs may visually collapse them.
161 return style->collapseWhiteSpace() 161 return style->collapseWhiteSpace()
162 || (whitespacePosition == TrailingWhitespace && style->whiteSpace() == P RE_WRAP && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly())); 162 || (whitespacePosition == TrailingWhitespace && style->whiteSpace() == P RE_WRAP && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly()));
163 } 163 }
164 164
165 inline bool requiresLineBoxForContent(RenderInline* flow, const LineInfo& lineIn fo) 165 inline bool requiresLineBoxForContent(RenderInline* flow, const LineInfo& lineIn fo)
166 { 166 {
167 RenderObject* parent = flow->parent(); 167 RenderObject* parent = flow->parent();
168 if (flow->document().inNoQuirksMode() 168 if (flow->document().inNoQuirksMode()
169 && (flow->style(lineInfo.isFirstLine())->lineHeight() != parent->style(l ineInfo.isFirstLine())->lineHeight() 169 && (flow->style(lineInfo.isFirstLine() ? FirstLineStyle : OwnStyle)->lin eHeight() != parent->style(lineInfo.isFirstLine() ? FirstLineStyle : OwnStyle)-> lineHeight()
170 || flow->style()->verticalAlign() != parent->style()->verticalAlign() 170 || flow->style()->verticalAlign() != parent->style()->verticalAlign()
171 || !parent->style()->font().fontMetrics().hasIdenticalAscentDescentAndLi neGap(flow->style()->font().fontMetrics()))) 171 || !parent->style()->font().fontMetrics().hasIdenticalAscentDescentAndLi neGap(flow->style()->font().fontMetrics())))
172 return true; 172 return true;
173 return false; 173 return false;
174 } 174 }
175 175
176 inline bool alwaysRequiresLineBox(RenderObject* flow) 176 inline bool alwaysRequiresLineBox(RenderObject* flow)
177 { 177 {
178 // FIXME: Right now, we only allow line boxes for inlines that are truly emp ty. 178 // FIXME: Right now, we only allow line boxes for inlines that are truly emp ty.
179 // We need to fix this, though, because at the very least, inlines containin g only 179 // We need to fix this, though, because at the very least, inlines containin g only
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 RenderCombineText* combineRenderer = toRenderCombineText(m_current.objec t()); 538 RenderCombineText* combineRenderer = toRenderCombineText(m_current.objec t());
539 combineRenderer->combineText(); 539 combineRenderer->combineText();
540 // The length of the renderer's text may have changed. Increment stale i terator positions 540 // The length of the renderer's text may have changed. Increment stale i terator positions
541 if (iteratorIsBeyondEndOfRenderCombineText(m_lineBreak, combineRenderer) ) { 541 if (iteratorIsBeyondEndOfRenderCombineText(m_lineBreak, combineRenderer) ) {
542 ASSERT(iteratorIsBeyondEndOfRenderCombineText(m_resolver.position(), combineRenderer)); 542 ASSERT(iteratorIsBeyondEndOfRenderCombineText(m_resolver.position(), combineRenderer));
543 m_lineBreak.increment(); 543 m_lineBreak.increment();
544 m_resolver.position().increment(&m_resolver); 544 m_resolver.position().increment(&m_resolver);
545 } 545 }
546 } 546 }
547 547
548 RenderStyle* style = renderText->style(m_lineInfo.isFirstLine()); 548 RenderStyle* style = renderText->style(m_lineInfo.isFirstLine() ? FirstLineS tyle : OwnStyle);
549 const Font& font = style->font(); 549 const Font& font = style->font();
550 bool isFixedPitch = font.isFixedPitch(); 550 bool isFixedPitch = font.isFixedPitch();
551 551
552 unsigned lastSpace = m_current.offset(); 552 unsigned lastSpace = m_current.offset();
553 float wordSpacing = m_currentStyle->wordSpacing(); 553 float wordSpacing = m_currentStyle->wordSpacing();
554 float lastSpaceWordSpacing = 0; 554 float lastSpaceWordSpacing = 0;
555 float wordSpacingForWordMeasurement = 0; 555 float wordSpacingForWordMeasurement = 0;
556 556
557 float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.obje ct(), !m_appliedStartWidth, true); 557 float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.obje ct(), !m_appliedStartWidth, true);
558 float charWidth = 0; 558 float charWidth = 0;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 901
902 if (style->textIndentType() == TextIndentHanging) 902 if (style->textIndentType() == TextIndentHanging)
903 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText; 903 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText;
904 904
905 return shouldIndentText; 905 return shouldIndentText;
906 } 906 }
907 907
908 } 908 }
909 909
910 #endif // BreakingContextInlineHeaders_h 910 #endif // BreakingContextInlineHeaders_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RootInlineBox.cpp ('k') | Source/core/rendering/line/LineWidth.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698