PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { RefPtr<StringImpl> result = LayoutText::originalText(); if (!result) return nullptr; return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == PRE); }
void RenderSVGInlineText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderText::styleDidChange(diff, oldStyle); updateScaledFont(); bool newPreserves = style().whiteSpace() == PRE; bool oldPreserves = oldStyle ? oldStyle->whiteSpace() == PRE : false; if (oldPreserves && !newPreserves) { setText(applySVGWhitespaceRules(originalText(), false), true); return; } if (!oldPreserves && newPreserves) { setText(applySVGWhitespaceRules(originalText(), true), true); return; } if (diff != StyleDifferenceLayout) return; // The text metrics may be influenced by style changes. if (auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this)) textAncestor->subtreeStyleDidChange(this); }
void RenderSVGInlineText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderText::styleDidChange(diff, oldStyle); if (diff == StyleDifferenceLayout) { // The text metrics may be influenced by style changes. if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this)) textRenderer->setNeedsPositioningValuesUpdate(); } const RenderStyle* newStyle = style(); if (!newStyle || newStyle->whiteSpace() != PRE) return; if (!oldStyle || oldStyle->whiteSpace() != PRE) setText(applySVGWhitespaceRules(originalText(), true), true); }
RenderSVGInlineText::RenderSVGInlineText(Node* n, PassRefPtr<StringImpl> string) : RenderText(n, applySVGWhitespaceRules(string, false)) { }
LayoutSVGInlineText::LayoutSVGInlineText(Node* n, PassRefPtr<StringImpl> string) : LayoutText(n, applySVGWhitespaceRules(string, false)) , m_scalingFactor(1) , m_layoutAttributes(this) { }
RenderSVGInlineText::RenderSVGInlineText(Text& textNode, const String& string) : RenderText(textNode, applySVGWhitespaceRules(string, false)) , m_scalingFactor(1) , m_layoutAttributes(*this) { }