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

Side by Side Diff: sky/engine/core/rendering/RenderInline.cpp

Issue 847053002: Remove StyleEngine::usesFirstLineRules(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.cpp ('k') | sky/engine/core/rendering/RootInlineBox.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) 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 RenderStyle* parentStyle = parent()->style(); 129 RenderStyle* parentStyle = parent()->style();
130 RenderInline* parentRenderInline = parent()->isRenderInline() ? toRenderInli ne(parent()) : 0; 130 RenderInline* parentRenderInline = parent()->isRenderInline() ? toRenderInli ne(parent()) : 0;
131 bool alwaysCreateLineBoxesNew = (parentRenderInline && parentRenderInline->a lwaysCreateLineBoxes()) 131 bool alwaysCreateLineBoxesNew = (parentRenderInline && parentRenderInline->a lwaysCreateLineBoxes())
132 || (parentRenderInline && parentStyle->verticalAlign() != BASELINE) 132 || (parentRenderInline && parentStyle->verticalAlign() != BASELINE)
133 || style()->verticalAlign() != BASELINE 133 || style()->verticalAlign() != BASELINE
134 || style()->textEmphasisMark() != TextEmphasisMarkNone 134 || style()->textEmphasisMark() != TextEmphasisMarkNone
135 || !parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGa p(style()->font().fontMetrics()) 135 || !parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGa p(style()->font().fontMetrics())
136 || parentStyle->lineHeight() != style()->lineHeight(); 136 || parentStyle->lineHeight() != style()->lineHeight();
137 137
138 if (!alwaysCreateLineBoxesNew && document().styleEngine()->usesFirstLineRule s()) {
139 // Have to check the first line style as well.
140 parentStyle = parent()->style(true);
141 RenderStyle* childStyle = style(true);
142 alwaysCreateLineBoxesNew = !parentStyle->font().fontMetrics().hasIdentic alAscentDescentAndLineGap(childStyle->font().fontMetrics())
143 || childStyle->verticalAlign() != BASELINE
144 || parentStyle->lineHeight() != childStyle->lineHeight();
145 }
146
147 if (alwaysCreateLineBoxesNew) { 138 if (alwaysCreateLineBoxesNew) {
148 if (!fullLayout) 139 if (!fullLayout)
149 dirtyLineBoxes(false); 140 dirtyLineBoxes(false);
150 setAlwaysCreateLineBoxes(); 141 setAlwaysCreateLineBoxes();
151 } 142 }
152 } 143 }
153 144
154 LayoutRect RenderInline::localCaretRect(InlineBox* inlineBox, int, LayoutUnit* e xtraWidthToEndOfLine) 145 LayoutRect RenderInline::localCaretRect(InlineBox* inlineBox, int, LayoutUnit* e xtraWidthToEndOfLine)
155 { 146 {
156 if (firstChild()) { 147 if (firstChild()) {
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() 768 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox()
778 { 769 {
779 setAlwaysCreateLineBoxes(); 770 setAlwaysCreateLineBoxes();
780 InlineFlowBox* flowBox = createInlineFlowBox(); 771 InlineFlowBox* flowBox = createInlineFlowBox();
781 m_lineBoxes.appendLineBox(flowBox); 772 m_lineBoxes.appendLineBox(flowBox);
782 return flowBox; 773 return flowBox;
783 } 774 }
784 775
785 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio n*/, LinePositionMode /*linePositionMode*/) const 776 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio n*/, LinePositionMode /*linePositionMode*/) const
786 { 777 {
787 if (firstLine && document().styleEngine()->usesFirstLineRules()) {
788 RenderStyle* s = style(firstLine);
789 if (s != style())
790 return s->computedLineHeight();
791 }
792
793 return style()->computedLineHeight(); 778 return style()->computedLineHeight();
794 } 779 }
795 780
796 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const 781 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const
797 { 782 {
798 ASSERT(linePositionMode == PositionOnContainingLine); 783 ASSERT(linePositionMode == PositionOnContainingLine);
799 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); 784 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics();
800 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 785 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
801 } 786 }
802 787
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 pixelSnappedBox.maxY(), 1012 pixelSnappedBox.maxY(),
1028 pixelSnappedBox.maxX() + outlineWidth, 1013 pixelSnappedBox.maxX() + outlineWidth,
1029 pixelSnappedBox.maxY() + outlineWidth, 1014 pixelSnappedBox.maxY() + outlineWidth,
1030 BSBottom, outlineColor, outlineStyle, 1015 BSBottom, outlineColor, outlineStyle,
1031 outlineWidth, 1016 outlineWidth,
1032 outlineWidth, 1017 outlineWidth,
1033 antialias); 1018 antialias);
1034 } 1019 }
1035 1020
1036 } // namespace blink 1021 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.cpp ('k') | sky/engine/core/rendering/RootInlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698