PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const
{
    RefPtr<StringImpl> result = LayoutText::originalText();
    if (!result)
        return nullptr;
    return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == PRE);
}
예제 #2
0
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);
}
예제 #3
0
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);
}
예제 #4
0
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)
{
}
예제 #6
0
RenderSVGInlineText::RenderSVGInlineText(Text& textNode, const String& string)
    : RenderText(textNode, applySVGWhitespaceRules(string, false))
    , m_scalingFactor(1)
    , m_layoutAttributes(*this)
{
}