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

Unified Diff: Source/core/layout/line/InlineFlowBox.cpp

Issue 910083002: Constify and use LayoutStyle reference in layout/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined again Created 5 years, 10 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/layout/line/EllipsisBox.cpp ('k') | Source/core/layout/line/InlineIterator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/line/InlineFlowBox.cpp
diff --git a/Source/core/layout/line/InlineFlowBox.cpp b/Source/core/layout/line/InlineFlowBox.cpp
index 1d413227f88586c19536846b8d2321b97aa40ccd..5ba81bb8e72daaab081d3dbb817db32e57c380ee 100644
--- a/Source/core/layout/line/InlineFlowBox.cpp
+++ b/Source/core/layout/line/InlineFlowBox.cpp
@@ -120,19 +120,19 @@ void InlineFlowBox::addToLine(InlineBox* child)
}
if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer().isOutOfFlowPositioned()) {
- LayoutStyle* parentStyle = renderer().style(isFirstLineStyle());
- LayoutStyle* childStyle = child->renderer().style(isFirstLineStyle());
+ const LayoutStyle& parentStyle = renderer().styleRef(isFirstLineStyle());
+ const LayoutStyle& childStyle = child->renderer().styleRef(isFirstLineStyle());
bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false;
if (child->renderer().isReplaced()) {
shouldClearDescendantsHaveSameLineHeightAndBaseline = true;
} else if (child->isText()) {
if (child->renderer().isBR() || child->renderer().parent() != renderer()) {
- if (!parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle->font().fontMetrics())
- || parentStyle->lineHeight() != childStyle->lineHeight()
- || (parentStyle->verticalAlign() != BASELINE && !isRootInlineBox()) || childStyle->verticalAlign() != BASELINE)
+ if (!parentStyle.font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.font().fontMetrics())
+ || parentStyle.lineHeight() != childStyle.lineHeight()
+ || (parentStyle.verticalAlign() != BASELINE && !isRootInlineBox()) || childStyle.verticalAlign() != BASELINE)
shouldClearDescendantsHaveSameLineHeightAndBaseline = true;
}
- if (childStyle->hasTextCombine() || childStyle->textEmphasisMark() != TextEmphasisMarkNone)
+ if (childStyle.hasTextCombine() || childStyle.textEmphasisMark() != TextEmphasisMarkNone)
shouldClearDescendantsHaveSameLineHeightAndBaseline = true;
} else {
if (child->renderer().isBR()) {
@@ -144,10 +144,10 @@ void InlineFlowBox::addToLine(InlineBox* child)
InlineFlowBox* childFlowBox = toInlineFlowBox(child);
// Check the child's bit, and then also check for differences in font, line-height, vertical-align
if (!childFlowBox->descendantsHaveSameLineHeightAndBaseline()
- || !parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle->font().fontMetrics())
- || parentStyle->lineHeight() != childStyle->lineHeight()
- || (parentStyle->verticalAlign() != BASELINE && !isRootInlineBox()) || childStyle->verticalAlign() != BASELINE
- || childStyle->hasBorder() || childStyle->hasPadding() || childStyle->hasTextCombine())
+ || !parentStyle.font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.font().fontMetrics())
+ || parentStyle.lineHeight() != childStyle.lineHeight()
+ || (parentStyle.verticalAlign() != BASELINE && !isRootInlineBox()) || childStyle.verticalAlign() != BASELINE
+ || childStyle.hasBorder() || childStyle.hasPadding() || childStyle.hasTextCombine())
shouldClearDescendantsHaveSameLineHeightAndBaseline = true;
}
}
@@ -158,8 +158,8 @@ void InlineFlowBox::addToLine(InlineBox* child)
if (!child->renderer().isOutOfFlowPositioned()) {
if (child->isText()) {
- LayoutStyle* childStyle = child->renderer().style(isFirstLineStyle());
- if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || childStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeWidth())
+ const LayoutStyle& childStyle = child->renderer().styleRef(isFirstLineStyle());
+ if (childStyle.letterSpacing() < 0 || childStyle.textShadow() || childStyle.textEmphasisMark() != TextEmphasisMarkNone || childStyle.textStrokeWidth())
child->clearKnownToHaveNoOverflow();
} else if (child->renderer().isReplaced()) {
RenderBox& box = toRenderBox(child->renderer());
@@ -778,9 +778,9 @@ inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
if (!parent())
return;
- LayoutStyle* style = renderer().style(isFirstLineStyle());
- WritingMode writingMode = style->writingMode();
- ShadowList* boxShadow = style->boxShadow();
+ const LayoutStyle& style = renderer().styleRef(isFirstLineStyle());
+ WritingMode writingMode = style.writingMode();
+ ShadowList* boxShadow = style.boxShadow();
if (!boxShadow)
return;
@@ -800,13 +800,13 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
if (!parent())
return;
- LayoutStyle* style = renderer().style(isFirstLineStyle());
- if (!style->hasBorderImageOutsets())
+ const LayoutStyle& style = renderer().styleRef(isFirstLineStyle());
+ if (!style.hasBorderImageOutsets())
return;
// Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since
// the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes.
- LayoutRectOutsets logicalOutsets = style->borderImageOutsets().logicalOutsetsWithFlippedLines(style->writingMode());
+ LayoutRectOutsets logicalOutsets = style.borderImageOutsets().logicalOutsetsWithFlippedLines(style.writingMode());
if (!includeLogicalLeftEdge())
logicalOutsets.setLeft(LayoutUnit());
@@ -824,11 +824,11 @@ inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
if (!parent())
return;
- LayoutStyle* style = renderer().style(isFirstLineStyle());
- if (!style->hasOutline())
+ const LayoutStyle& style = renderer().styleRef(isFirstLineStyle());
+ if (!style.hasOutline())
return;
- logicalVisualOverflow.inflate(style->outlineSize());
+ logicalVisualOverflow.inflate(style.outlineSize());
}
inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow)
@@ -1237,13 +1237,13 @@ LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos
}
if (curr->isInlineTextBox()) {
- LayoutStyle* style = curr->renderer().style(isFirstLineStyle());
- if (style->textEmphasisMark() != TextEmphasisMarkNone && style->textEmphasisPosition() == TextEmphasisPositionUnder) {
- if (!style->isFlippedLinesWritingMode()) {
- LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + style->font().emphasisMarkHeight(style->textEmphasisMarkString());
+ const LayoutStyle& style = curr->renderer().styleRef(isFirstLineStyle());
+ if (style.textEmphasisMark() != TextEmphasisMarkNone && style.textEmphasisPosition() == TextEmphasisPositionUnder) {
+ if (!style.isFlippedLinesWritingMode()) {
+ LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + style.font().emphasisMarkHeight(style.textEmphasisMarkString());
result = std::max(result, bottomOfEmphasisMark - allowedPosition);
} else {
- LayoutUnit topOfEmphasisMark = curr->logicalTop() - style->font().emphasisMarkHeight(style->textEmphasisMarkString());
+ LayoutUnit topOfEmphasisMark = curr->logicalTop() - style.font().emphasisMarkHeight(style.textEmphasisMarkString());
result = std::max(result, allowedPosition - topOfEmphasisMark);
}
}
« no previous file with comments | « Source/core/layout/line/EllipsisBox.cpp ('k') | Source/core/layout/line/InlineIterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698