void LayoutSVGInlineText::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle) { LayoutText::styleDidChange(diff, oldStyle); updateScaledFont(); bool newPreserves = style() ? style()->whiteSpace() == PRE : false; bool oldPreserves = oldStyle ? oldStyle->whiteSpace() == PRE : false; if (oldPreserves != newPreserves) { setText(originalText(), true); return; } if (!diff.needsFullLayout()) return; // The text metrics may be influenced by style changes. if (LayoutSVGText* textLayoutObject = LayoutSVGText::locateLayoutSVGTextAncestor(this)) textLayoutObject->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::StyleChange); }
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); }