Index: Source/core/rendering/InlineFlowBox.cpp |
diff --git a/Source/core/rendering/InlineFlowBox.cpp b/Source/core/rendering/InlineFlowBox.cpp |
index dd149d90349e50d6a5783df598cd66d948f18f6b..cab084da6928bbf676af56b4a66c80e1f100fad4 100644 |
--- a/Source/core/rendering/InlineFlowBox.cpp |
+++ b/Source/core/rendering/InlineFlowBox.cpp |
@@ -116,8 +116,8 @@ void InlineFlowBox::addToLine(InlineBox* child) |
} |
if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer().isOutOfFlowPositioned()) { |
- RenderStyle* parentStyle = renderer().style(isFirstLineStyle()); |
- RenderStyle* childStyle = child->renderer().style(isFirstLineStyle()); |
+ RenderStyle* parentStyle = renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
+ RenderStyle* childStyle = child->renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; |
if (child->renderer().isReplaced()) |
shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
@@ -154,17 +154,17 @@ void InlineFlowBox::addToLine(InlineBox* child) |
if (!child->renderer().isOutOfFlowPositioned()) { |
if (child->isText()) { |
- RenderStyle* childStyle = child->renderer().style(isFirstLineStyle()); |
+ RenderStyle* childStyle = child->renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || childStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeWidth()) |
child->clearKnownToHaveNoOverflow(); |
} else if (child->renderer().isReplaced()) { |
RenderBox& box = toRenderBox(child->renderer()); |
if (box.hasRenderOverflow() || box.hasSelfPaintingLayer()) |
child->clearKnownToHaveNoOverflow(); |
- } else if (!child->renderer().isBR() && (child->renderer().style(isFirstLineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer() |
+ } else if (!child->renderer().isBR() && (child->renderer().styleOrFirstLineStyle(isFirstLineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer() |
|| (child->renderer().isListMarker() && !toRenderListMarker(child->renderer()).isInside()) |
- || child->renderer().style(isFirstLineStyle())->hasBorderImageOutsets() |
- || child->renderer().style(isFirstLineStyle())->hasOutline())) { |
+ || child->renderer().styleOrFirstLineStyle(isFirstLineStyle())->hasBorderImageOutsets() |
+ || child->renderer().styleOrFirstLineStyle(isFirstLineStyle())->hasOutline())) { |
child->clearKnownToHaveNoOverflow(); |
} |
@@ -382,7 +382,7 @@ float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inlin |
RenderText& rt = toRenderText(text->renderer()); |
if (rt.textLength()) { |
if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->start()))) |
- logicalLeft += rt.style(isFirstLineStyle())->font().fontDescription().wordSpacing(); |
+ logicalLeft += rt.styleOrFirstLineStyle(isFirstLineStyle())->font().fontDescription().wordSpacing(); |
needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end())); |
} |
text->setLogicalLeft(logicalLeft); |
@@ -439,8 +439,8 @@ bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo |
if (isHorizontal()) |
return false; |
- if (renderer().style(isFirstLineStyle())->fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright |
- || renderer().style(isFirstLineStyle())->font().primaryFont()->hasVerticalGlyphs()) |
+ if (renderer().styleOrFirstLineStyle(isFirstLineStyle())->fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright |
+ || renderer().styleOrFirstLineStyle(isFirstLineStyle())->font().primaryFont()->hasVerticalGlyphs()) |
return true; |
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
@@ -451,7 +451,7 @@ bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo |
if (toInlineFlowBox(curr)->requiresIdeographicBaseline(textBoxDataMap)) |
return true; |
} else { |
- if (curr->renderer().style(isFirstLineStyle())->font().primaryFont()->hasVerticalGlyphs()) |
+ if (curr->renderer().styleOrFirstLineStyle(isFirstLineStyle())->font().primaryFont()->hasVerticalGlyphs()) |
return true; |
const Vector<const SimpleFontData*>* usedFonts = 0; |
@@ -601,7 +601,7 @@ void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei |
{ |
bool isRootBox = isRootInlineBox(); |
if (isRootBox) { |
- const FontMetrics& fontMetrics = renderer().style(isFirstLineStyle())->fontMetrics(); |
+ const FontMetrics& fontMetrics = renderer().styleOrFirstLineStyle(isFirstLineStyle())->fontMetrics(); |
// RootInlineBoxes are always placed on at pixel boundaries in their logical y direction. Not doing |
// so results in incorrect rendering of text decorations, most notably underlines. |
setLogicalTop(roundToInt(top + maxAscent - fontMetrics.ascent(baselineType))); |
@@ -643,11 +643,11 @@ void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei |
LayoutUnit boxHeightIncludingMargins = boxHeight; |
LayoutUnit borderPaddingHeight = 0; |
if (curr->isText() || curr->isInlineFlowBox()) { |
- const FontMetrics& fontMetrics = curr->renderer().style(isFirstLineStyle())->fontMetrics(); |
+ const FontMetrics& fontMetrics = curr->renderer().styleOrFirstLineStyle(isFirstLineStyle())->fontMetrics(); |
newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics.ascent(baselineType); |
if (curr->isInlineFlowBox()) { |
RenderBoxModelObject& boxObject = toRenderBoxModelObject(curr->renderer()); |
- newLogicalTop -= boxObject.style(isFirstLineStyle())->isHorizontalWritingMode() ? boxObject.borderTop() + boxObject.paddingTop() : |
+ newLogicalTop -= boxObject.styleOrFirstLineStyle(isFirstLineStyle())->isHorizontalWritingMode() ? boxObject.borderTop() + boxObject.paddingTop() : |
boxObject.borderRight() + boxObject.paddingRight(); |
borderPaddingHeight = boxObject.borderAndPaddingLogicalHeight(); |
} |
@@ -683,9 +683,9 @@ void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei |
} |
if (curr->isInlineTextBox()) { |
TextEmphasisPosition emphasisMarkPosition; |
- if (toInlineTextBox(curr)->getEmphasisMarkPosition(curr->renderer().style(isFirstLineStyle()), emphasisMarkPosition)) { |
+ if (toInlineTextBox(curr)->getEmphasisMarkPosition(curr->renderer().styleOrFirstLineStyle(isFirstLineStyle()), emphasisMarkPosition)) { |
bool emphasisMarkIsOver = emphasisMarkPosition == TextEmphasisPositionOver; |
- if (emphasisMarkIsOver != curr->renderer().style(isFirstLineStyle())->isFlippedLinesWritingMode()) |
+ if (emphasisMarkIsOver != curr->renderer().styleOrFirstLineStyle(isFirstLineStyle())->isFlippedLinesWritingMode()) |
hasAnnotationsBefore = true; |
else |
hasAnnotationsAfter = true; |
@@ -771,7 +771,7 @@ inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO |
if (!parent()) |
return; |
- RenderStyle* style = renderer().style(isFirstLineStyle()); |
+ RenderStyle* style = renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
if (!style->boxShadow()) |
return; |
@@ -804,7 +804,7 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu |
if (!parent()) |
return; |
- RenderStyle* style = renderer().style(isFirstLineStyle()); |
+ RenderStyle* style = renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
if (!style->hasBorderImageOutsets()) |
return; |
@@ -839,7 +839,7 @@ inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve |
if (!parent()) |
return; |
- RenderStyle* style = renderer().style(isFirstLineStyle()); |
+ RenderStyle* style = renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
if (!style->hasOutline()) |
return; |
@@ -851,7 +851,7 @@ inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp |
if (textBox->knownToHaveNoOverflow()) |
return; |
- RenderStyle* style = textBox->renderer().style(isFirstLineStyle()); |
+ RenderStyle* style = textBox->renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox); |
GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.second; |
@@ -1298,7 +1298,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& |
// You can use p::first-line to specify a background. If so, the root line boxes for |
// a line may actually have to paint a background. |
- RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); |
+ RenderStyle* styleToUse = renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
if ((!parent() && isFirstLineStyle() && styleToUse != renderer().style()) || (parent() && renderer().hasBoxDecorations())) { |
LayoutRect paintRect = LayoutRect(adjustedPaintoffset, frameRect.size()); |
// Shadow comes first and is behind the background and border. |
@@ -1321,7 +1321,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& |
// The simple case is where we either have no border image or we are the only box for this object. In those |
// cases only a single call to draw is required. |
if (!hasBorderImage || (!prevLineBox() && !nextLineBox())) |
- boxModelObject()->paintBorder(paintInfo, paintRect, renderer().style(isFirstLineStyle()), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge()); |
+ boxModelObject()->paintBorder(paintInfo, paintRect, renderer().styleOrFirstLineStyle(isFirstLineStyle()), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge()); |
else { |
// We have a border image that spans multiple lines. |
// We need to adjust tx and ty by the width of all previous lines. |
@@ -1345,7 +1345,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& |
LayoutRect clipRect = clipRectForNinePieceImageStrip(this, borderImage, paintRect); |
GraphicsContextStateSaver stateSaver(*context); |
context->clip(clipRect); |
- boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer().style(isFirstLineStyle())); |
+ boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer().styleOrFirstLineStyle(isFirstLineStyle())); |
} |
} |
} |
@@ -1522,7 +1522,7 @@ LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi |
} |
if (curr->isInlineTextBox()) { |
- RenderStyle* style = curr->renderer().style(isFirstLineStyle()); |
+ RenderStyle* style = curr->renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
TextEmphasisPosition emphasisMarkPosition; |
if (style->textEmphasisMark() != TextEmphasisMarkNone && toInlineTextBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMarkPosition == TextEmphasisPositionOver) { |
if (!style->isFlippedLinesWritingMode()) { |
@@ -1570,7 +1570,7 @@ LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos |
} |
if (curr->isInlineTextBox()) { |
- RenderStyle* style = curr->renderer().style(isFirstLineStyle()); |
+ RenderStyle* style = curr->renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
if (style->textEmphasisMark() != TextEmphasisMarkNone && style->textEmphasisPosition() == TextEmphasisPositionUnder) { |
if (!style->isFlippedLinesWritingMode()) { |
LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + style->font().emphasisMarkHeight(style->textEmphasisMarkString()); |