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

Side by Side Diff: Source/core/rendering/RenderInline.cpp

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/RenderInline.h ('k') | Source/core/rendering/RenderListBox.h » ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 bool checkFonts = document().inNoQuirksMode(); 210 bool checkFonts = document().inNoQuirksMode();
211 bool alwaysCreateLineBoxes = (parentRenderInline && parentRenderInline->alwa ysCreateLineBoxes()) 211 bool alwaysCreateLineBoxes = (parentRenderInline && parentRenderInline->alwa ysCreateLineBoxes())
212 || (parentRenderInline && parentStyle->verticalAlign() != BASELINE) 212 || (parentRenderInline && parentStyle->verticalAlign() != BASELINE)
213 || style()->verticalAlign() != BASELINE 213 || style()->verticalAlign() != BASELINE
214 || style()->textEmphasisMark() != TextEmphasisMarkNone 214 || style()->textEmphasisMark() != TextEmphasisMarkNone
215 || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscent DescentAndLineGap(style()->font().fontMetrics()) 215 || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscent DescentAndLineGap(style()->font().fontMetrics())
216 || parentStyle->lineHeight() != style()->lineHeight())); 216 || parentStyle->lineHeight() != style()->lineHeight()));
217 217
218 if (!alwaysCreateLineBoxes && checkFonts && document().styleEngine()->usesFi rstLineRules()) { 218 if (!alwaysCreateLineBoxes && checkFonts && document().styleEngine()->usesFi rstLineRules()) {
219 // Have to check the first line style as well. 219 // Have to check the first line style as well.
220 parentStyle = parent()->style(true); 220 parentStyle = parent()->style(FirstLineStyle);
221 RenderStyle* childStyle = style(true); 221 RenderStyle* childStyle = style(FirstLineStyle);
222 alwaysCreateLineBoxes = !parentStyle->font().fontMetrics().hasIdenticalA scentDescentAndLineGap(childStyle->font().fontMetrics()) 222 alwaysCreateLineBoxes = !parentStyle->font().fontMetrics().hasIdenticalA scentDescentAndLineGap(childStyle->font().fontMetrics())
223 || childStyle->verticalAlign() != BASELINE 223 || childStyle->verticalAlign() != BASELINE
224 || parentStyle->lineHeight() != childStyle->lineHeight(); 224 || parentStyle->lineHeight() != childStyle->lineHeight();
225 } 225 }
226 226
227 if (alwaysCreateLineBoxes) { 227 if (alwaysCreateLineBoxes) {
228 if (!fullLayout) 228 if (!fullLayout)
229 dirtyLineBoxes(false); 229 dirtyLineBoxes(false);
230 m_alwaysCreateLineBoxes = true; 230 m_alwaysCreateLineBoxes = true;
231 } 231 }
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 } 1270 }
1271 1271
1272 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() 1272 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox()
1273 { 1273 {
1274 setAlwaysCreateLineBoxes(); 1274 setAlwaysCreateLineBoxes();
1275 InlineFlowBox* flowBox = createInlineFlowBox(); 1275 InlineFlowBox* flowBox = createInlineFlowBox();
1276 m_lineBoxes.appendLineBox(flowBox); 1276 m_lineBoxes.appendLineBox(flowBox);
1277 return flowBox; 1277 return flowBox;
1278 } 1278 }
1279 1279
1280 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio n*/, LinePositionMode /*linePositionMode*/) const 1280 LayoutUnit RenderInline::lineHeight(OwnOrFirstLineStyle firstLine, LineDirection Mode /*direction*/, LinePositionMode /*linePositionMode*/) const
1281 { 1281 {
1282 if (firstLine && document().styleEngine()->usesFirstLineRules()) { 1282 if (firstLine == FirstLineStyle && document().styleEngine()->usesFirstLineRu les()) {
1283 RenderStyle* s = style(firstLine); 1283 RenderStyle* s = style(firstLine);
1284 if (s != style()) 1284 if (s != style())
1285 return s->computedLineHeight(); 1285 return s->computedLineHeight();
1286 } 1286 }
1287 1287
1288 return style()->computedLineHeight(); 1288 return style()->computedLineHeight();
1289 } 1289 }
1290 1290
1291 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const 1291 int RenderInline::baselinePosition(FontBaseline baselineType, OwnOrFirstLineStyl e firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) con st
1292 { 1292 {
1293 ASSERT(linePositionMode == PositionOnContainingLine); 1293 ASSERT(linePositionMode == PositionOnContainingLine);
1294 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); 1294 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics();
1295 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 1295 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
1296 } 1296 }
1297 1297
1298 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child) const 1298 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child) const
1299 { 1299 {
1300 // FIXME: This function isn't right with mixed writing modes. 1300 // FIXME: This function isn't right with mixed writing modes.
1301 1301
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 regions.append(region); 1569 regions.append(region);
1570 } 1570 }
1571 1571
1572 void RenderInline::invalidateTreeAfterLayout(const RenderLayerModelObject& paint InvalidationContainer) 1572 void RenderInline::invalidateTreeAfterLayout(const RenderLayerModelObject& paint InvalidationContainer)
1573 { 1573 {
1574 LayoutState state(*this); 1574 LayoutState state(*this);
1575 RenderObject::invalidateTreeAfterLayout(paintInvalidationContainer); 1575 RenderObject::invalidateTreeAfterLayout(paintInvalidationContainer);
1576 } 1576 }
1577 1577
1578 } // namespace WebCore 1578 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderInline.h ('k') | Source/core/rendering/RenderListBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698