[webkit-changes] [WebKit/WebKit] af1356: Don't propagate bbox for empty `text` to ancestors

Ahmad Saleem noreply at github.com
Sat Jan 25 16:19:06 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: af13560660544215afd576e1649975f14f7828e2
      https://github.com/WebKit/WebKit/commit/af13560660544215afd576e1649975f14f7828e2
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2025-01-25 (Sat, 25 Jan 2025)

  Changed paths:
    A LayoutTests/svg/text/text-bbox-empty-expected.txt
    A LayoutTests/svg/text/text-bbox-empty.html
    M Source/WebCore/rendering/svg/RenderSVGText.cpp
    M Source/WebCore/rendering/svg/RenderSVGText.h
    M Source/WebCore/rendering/svg/SVGRenderSupport.cpp

  Log Message:
  -----------
  Don't propagate bbox for empty `text` to ancestors

https://bugs.webkit.org/show_bug.cgi?id=261062
rdar://115217040

Reviewed by Alan Baradlay.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

Merge: https://chromium.googlesource.com/chromium/src.git/+/9960fef706fbd5429e65360e3ebeecce63c8c8f0

If we have a <text> element which is "empty" (essentially has no text
content after collapsing spaces), then its bounding box would be empty,
but would still be propagated to the bounding boxes of the ancestors -
which could span them out to be bigger than expected. Similarly they
could be subject to their userspace transform with a similar effect.

Skip propagation of empty <text> element - where "empty" is defined as
"has no line boxes".

* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::isObjectBoundingBoxValid const):
* Source/WebCore/rendering/svg/RenderSVGText.h:
* Source/WebCore/rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::computeContainerBoundingBoxes):
* LayoutTests/svg/text/text-bbox-empty.html: Add Test Case
* LayoutTests/svg/text/text-bbox-empty-expected.txt: Add Test Case Expectation

Canonical link: https://commits.webkit.org/289394@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