[webkit-changes] [WebKit/WebKit] bce920: Suppress zero-length text SVG inline renderers

Ahmad Saleem noreply at github.com
Thu Aug 29 04:23:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bce920e27ee7ce10c3ab46cec651368b974dd10a
      https://github.com/WebKit/WebKit/commit/bce920e27ee7ce10c3ab46cec651368b974dd10a
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2024-08-29 (Thu, 29 Aug 2024)

  Changed paths:
    M LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/text-altglyph-01-b-manual-expected.txt
    M LayoutTests/platform/glib/svg/text/font-size-below-point-five-expected.txt
    M LayoutTests/platform/glib/svg/text/textPathBoundsBug-expected.txt
    M LayoutTests/platform/gtk/svg/W3C-SVG-1.1/text-align-08-b-expected.txt
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/svg/import/text-altglyph-01-b-manual-expected.txt
    M LayoutTests/platform/ios/svg/W3C-SVG-1.1/text-align-08-b-expected.txt
    M LayoutTests/platform/ios/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt
    M LayoutTests/platform/ios/svg/text/font-size-below-point-five-expected.txt
    M LayoutTests/platform/ios/svg/text/text-altglyph-01-b-expected.txt
    M LayoutTests/platform/ios/svg/text/text-hkern-expected.txt
    M LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/text-altglyph-01-b-manual-expected.txt
    M LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-align-08-b-expected.txt
    M LayoutTests/platform/mac/svg/text/font-size-below-point-five-expected.txt
    M LayoutTests/platform/wpe/svg/W3C-SVG-1.1/text-align-08-b-expected.txt
    M LayoutTests/platform/wpe/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt
    M LayoutTests/platform/wpe/svg/text/text-altglyph-01-b-expected.txt
    M LayoutTests/svg/W3C-SVG-1.1/text-align-08-b-expected.txt
    M LayoutTests/svg/custom/invalid-text-content-expected.txt
    M LayoutTests/svg/text/textPathBoundsBug-expected.txt
    M LayoutTests/svg/text/textPathBoundsBug.svg
    M Source/WebCore/rendering/RenderText.h
    M Source/WebCore/rendering/svg/RenderSVGInline.cpp
    M Source/WebCore/rendering/svg/RenderSVGInline.h
    M Source/WebCore/rendering/svg/RenderSVGText.cpp

  Log Message:
  -----------
  Suppress zero-length text SVG inline renderers

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

Reviewed by Nikolas Zimmermann.

Partial Merge: https://chromium.googlesource.com/chromium/blink/+/e4c158a33d34264796abfa683d0413568dfdcde0

The SVG text layout functions assert non-zero metrics for SVG inline text
(see SVGTextLayoutEngine::layoutTextOnLineOrPath, for example). Normally,
we don't instantiate renderers for zero-length inline text (see Text::textRendererIsNeeded),
but the RenderSVGInlineText constructor  performs whitespace filtering to support xml:space semantics
(http://www.w3.org/TR/SVG/struct.html#LangSpaceAttrs) and can end up with
empty text while still passing the non-zero length test in Text::textRendererIsNeeded
(for example a single newline gets deleted when xml:space="default").

Enter RenderText::positionLineBox() which attempts to fix things up by
removing zero length inline boxes. But removing boxes at this point is bad
for business because it invalidates (marks as dirty and clears computed metrics)
parent boxes and sibling boxes during layout, and throws subsequent computations off.

The patch adds isChildAllowed()-based validation for SVG inline text. This prevents
zero-length-text renderers from being inserted into the tree in the first place.

* LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/text-altglyph-01-b-manual-expected.txt:
* LayoutTests/platform/glib/svg/text/font-size-below-point-five-expected.txt:
* LayoutTests/platform/glib/svg/text/textPathBoundsBug-expected.txt:
* LayoutTests/platform/gtk/svg/W3C-SVG-1.1/text-align-08-b-expected.txt:
* LayoutTests/platform/ios/svg/W3C-SVG-1.1/text-align-08-b-expected.txt:
* LayoutTests/platform/ios/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt:
* LayoutTests/platform/ios/svg/text/font-size-below-point-five-expected.txt:
* LayoutTests/platform/ios/svg/text/text-altglyph-01-b-expected.txt:
* LayoutTests/platform/ios/svg/text/text-hkern-expected.txt:
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/text-altglyph-01-b-manual-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/svg/import/text-altglyph-01-b-manual-expected.txt:
* LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-align-08-b-expected.txt:
* LayoutTests/platform/mac/svg/text/font-size-below-point-five-expected.txt:
* LayoutTests/platform/wpe/svg/W3C-SVG-1.1/text-align-08-b-expected.txt:
* LayoutTests/platform/wpe/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt:
* LayoutTests/platform/wpe/svg/text/text-altglyph-01-b-expected.txt:
* LayoutTests/svg/W3C-SVG-1.1/text-align-08-b-expected.txt:
* LayoutTests/svg/custom/invalid-text-content-expected.txt:
* LayoutTests/svg/text/textPathBoundsBug-expected.txt:
* LayoutTests/svg/text/textPathBoundsBug.svg:
* Source/WebCore/rendering/RenderText.h:
(WebCore::RenderText::hasEmptyText const):
* Source/WebCore/rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::isChildAllowed const):
* Source/WebCore/rendering/svg/RenderSVGInline.h:
* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::isChildAllowed const):

Canonical link: https://commits.webkit.org/282894@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list