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

Unified Diff: Source/core/rendering/RenderBlock.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 6737a7e3bdeb5f149668004ba2e4e8a1dd08c6ca..8b68935a4c720def4b53a09e1a314651b901f3ac 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -3760,7 +3760,7 @@ bool RenderBlock::hasLineIfEmpty() const
return false;
}
-LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+LayoutUnit RenderBlock::lineHeight(OwnOrFirstLineStyle firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
{
// Inline blocks are replaced elements. Otherwise, just pass off to
// the base class. If we're being queried as though we're the root line
@@ -3769,8 +3769,7 @@ LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
if (isReplaced() && linePositionMode == PositionOnContainingLine)
return RenderBox::lineHeight(firstLine, direction, linePositionMode);
- RenderStyle* s = style(firstLine && document().styleEngine()->usesFirstLineRules());
- return s->computedLineHeight();
+ return style(firstLine)->computedLineHeight();
}
int RenderBlock::beforeMarginInLineDirection(LineDirectionMode direction) const
@@ -3778,7 +3777,7 @@ int RenderBlock::beforeMarginInLineDirection(LineDirectionMode direction) const
return direction == HorizontalLine ? marginTop() : marginRight();
}
-int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+int RenderBlock::baselinePosition(FontBaseline baselineType, OwnOrFirstLineStyle firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
{
// Inline blocks are replaced elements. Otherwise, just pass off to
// the base class. If we're being queried as though we're the root line
@@ -3826,7 +3825,7 @@ int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin
return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
}
-LayoutUnit RenderBlock::minLineHeightForReplacedRenderer(bool isFirstLine, LayoutUnit replacedHeight) const
+LayoutUnit RenderBlock::minLineHeightForReplacedRenderer(OwnOrFirstLineStyle isFirstLine, LayoutUnit replacedHeight) const
{
if (!document().inNoQuirksMode() && replacedHeight)
return replacedHeight;
@@ -3844,7 +3843,7 @@ int RenderBlock::firstLineBoxBaseline() const
if (childrenInline()) {
if (firstLineBox())
- return firstLineBox()->logicalTop() + style(true)->fontMetrics().ascent(firstRootBox()->baselineType());
+ return firstLineBox()->logicalTop() + style(FirstLineStyle)->fontMetrics().ascent(firstRootBox()->baselineType());
else
return -1;
}
@@ -3880,11 +3879,11 @@ int RenderBlock::lastLineBoxBaseline(LineDirectionMode lineDirection) const
if (!firstLineBox() && hasLineIfEmpty()) {
const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics();
return fontMetrics.ascent()
- + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
- + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
+ + (lineHeight(FirstLineStyle, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
+ + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
}
if (lastLineBox())
- return lastLineBox()->logicalTop() + style(lastLineBox() == firstLineBox())->fontMetrics().ascent(lastRootBox()->baselineType());
+ return lastLineBox()->logicalTop() + style(lastLineBox() == firstLineBox() ? FirstLineStyle : OwnStyle)->fontMetrics().ascent(lastRootBox()->baselineType());
return -1;
} else {
bool haveNormalFlowChild = false;
@@ -3899,8 +3898,8 @@ int RenderBlock::lastLineBoxBaseline(LineDirectionMode lineDirection) const
if (!haveNormalFlowChild && hasLineIfEmpty()) {
const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics();
return fontMetrics.ascent()
- + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
- + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
+ + (lineHeight(FirstLineStyle, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
+ + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
}
}
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698