[Webkit-unassigned] [Bug 119719] Suppress zero-length text SVG inline renderers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 7 16:20:13 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=119719

--- Comment #4 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
I tried to merge this in the past: https://github.com/WebKit/WebKit/pull/4609

^ Honestly, my C++ skills were horrible at that time.

____________

Following compiles:

>> Source/WebCore/rendering/RenderText.h (on Line 89):

bool hasEmptyText() const { return m_text.isEmpty(); }

>> Source/WebCore/rendering/svg/RenderSVGInline.cpp (after namespace)

bool RenderSVGInline::isChildAllowed(const RenderObject& child, const RenderStyle& style) const
{
    if (SVGRenderSupport::isEmptySVGInlineText(&child))
        return false;

    return RenderElement::isChildAllowed(child, style);
}

>> Source/WebCore/rendering/svg/RenderSVGInline.h (on Line 36):

bool isChildAllowed(const RenderObject&, const RenderStyle&) const override;

>> Source/WebCore/rendering/svg/RenderSVGText.cpp (Line 79):

return child.isInline() && !SVGRenderSupport::isEmptySVGInlineText(&child);;

>> Source/WebCore/rendering/svg/SVGRenderSupport.cpp (Adding header and function at the end):

bool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object)
{
    // RenderSVGInlineText performs whitespace filtering in order to support xml:space
    // (http://www.w3.org/TR/SVG/struct.html#LangSpaceAttrs), and can end up with an empty string
    // even when its original constructor argument is non-empty.
    return object->isSVGInlineText() && downcast<RenderSVGInlineText>(object)->hasEmptyText();
}

>> Source/WebCore/rendering/svg/SVGRenderSupport.h:

static bool isEmptySVGInlineText(const RenderObject*);

>> Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp (in function: SVGTextLayoutEngine::currentVisualCharacterMetrics):

Delete Line 363 & 364

__________

I tested 'svg/custom/invalid-text-content-expected.svg' post above and it does remove following line:

RenderSVGInlineText {#text} at (0,0) size 0x0

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230707/02713cc4/attachment.htm>


More information about the webkit-unassigned mailing list