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

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

Issue 351033003: Simplify use of styleOrFirstLineStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@rename-style-bool-to-0
Patch Set: Created 6 years, 6 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/RenderBlock.cpp ('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) 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool checkFonts = document().inNoQuirksMode(); 209 bool checkFonts = document().inNoQuirksMode();
210 bool alwaysCreateLineBoxes = (parentRenderInline && parentRenderInline->alwa ysCreateLineBoxes()) 210 bool alwaysCreateLineBoxes = (parentRenderInline && parentRenderInline->alwa ysCreateLineBoxes())
211 || (parentRenderInline && parentStyle->verticalAlign() != BASELINE) 211 || (parentRenderInline && parentStyle->verticalAlign() != BASELINE)
212 || style()->verticalAlign() != BASELINE 212 || style()->verticalAlign() != BASELINE
213 || style()->textEmphasisMark() != TextEmphasisMarkNone 213 || style()->textEmphasisMark() != TextEmphasisMarkNone
214 || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscent DescentAndLineGap(style()->font().fontMetrics()) 214 || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscent DescentAndLineGap(style()->font().fontMetrics())
215 || parentStyle->lineHeight() != style()->lineHeight())); 215 || parentStyle->lineHeight() != style()->lineHeight()));
216 216
217 if (!alwaysCreateLineBoxes && checkFonts && document().styleEngine()->usesFi rstLineRules()) { 217 if (!alwaysCreateLineBoxes && checkFonts && document().styleEngine()->usesFi rstLineRules()) {
218 // Have to check the first line style as well. 218 // Have to check the first line style as well.
219 parentStyle = parent()->styleOrFirstLineStyle(true); 219 parentStyle = parent()->firstLineStyle();
220 RenderStyle* childStyle = styleOrFirstLineStyle(true); 220 RenderStyle* childStyle = firstLineStyle();
221 alwaysCreateLineBoxes = !parentStyle->font().fontMetrics().hasIdenticalA scentDescentAndLineGap(childStyle->font().fontMetrics()) 221 alwaysCreateLineBoxes = !parentStyle->font().fontMetrics().hasIdenticalA scentDescentAndLineGap(childStyle->font().fontMetrics())
222 || childStyle->verticalAlign() != BASELINE 222 || childStyle->verticalAlign() != BASELINE
223 || parentStyle->lineHeight() != childStyle->lineHeight(); 223 || parentStyle->lineHeight() != childStyle->lineHeight();
224 } 224 }
225 225
226 if (alwaysCreateLineBoxes) { 226 if (alwaysCreateLineBoxes) {
227 if (!fullLayout) 227 if (!fullLayout)
228 dirtyLineBoxes(false); 228 dirtyLineBoxes(false);
229 m_alwaysCreateLineBoxes = true; 229 m_alwaysCreateLineBoxes = true;
230 } 230 }
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() 1273 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox()
1274 { 1274 {
1275 setAlwaysCreateLineBoxes(); 1275 setAlwaysCreateLineBoxes();
1276 InlineFlowBox* flowBox = createInlineFlowBox(); 1276 InlineFlowBox* flowBox = createInlineFlowBox();
1277 m_lineBoxes.appendLineBox(flowBox); 1277 m_lineBoxes.appendLineBox(flowBox);
1278 return flowBox; 1278 return flowBox;
1279 } 1279 }
1280 1280
1281 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio n*/, LinePositionMode /*linePositionMode*/) const 1281 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio n*/, LinePositionMode /*linePositionMode*/) const
1282 { 1282 {
1283 if (firstLine && document().styleEngine()->usesFirstLineRules()) { 1283 return styleOrFirstLineStyle(firstLine)->computedLineHeight();
1284 RenderStyle* s = styleOrFirstLineStyle(firstLine);
1285 if (s != style())
1286 return s->computedLineHeight();
1287 }
1288
1289 return style()->computedLineHeight();
1290 } 1284 }
1291 1285
1292 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const 1286 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const
1293 { 1287 {
1294 ASSERT(linePositionMode == PositionOnContainingLine); 1288 ASSERT(linePositionMode == PositionOnContainingLine);
1295 const FontMetrics& fontMetrics = styleOrFirstLineStyle(firstLine)->fontMetri cs(); 1289 const FontMetrics& fontMetrics = styleOrFirstLineStyle(firstLine)->fontMetri cs();
1296 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 1290 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
1297 } 1291 }
1298 1292
1299 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child) const 1293 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child) const
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 container = this; 1558 container = this;
1565 1559
1566 FloatPoint absPos = container->localToAbsolute(); 1560 FloatPoint absPos = container->localToAbsolute();
1567 region.bounds.setX(absPos.x() + region.bounds.x()); 1561 region.bounds.setX(absPos.x() + region.bounds.x());
1568 region.bounds.setY(absPos.y() + region.bounds.y()); 1562 region.bounds.setY(absPos.y() + region.bounds.y());
1569 1563
1570 regions.append(region); 1564 regions.append(region);
1571 } 1565 }
1572 1566
1573 } // namespace WebCore 1567 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698