[webkit-changes] [WebKit/WebKit] 912165: [LBSE] Assure <foreignObject> HTML descendants cre...

Nikolas Zimmermann noreply at github.com
Mon Oct 17 07:35:08 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 912165516f6affad851ae15b53e5f350d5490b64
      https://github.com/WebKit/WebKit/commit/912165516f6affad851ae15b53e5f350d5490b64
  Author: Nikolas Zimmermann <nzimmermann at igalia.com>
  Date:   2022-10-17 (Mon, 17 Oct 2022)

  Changed paths:
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/mac-monterey-wk2-lbse-text/TestExpectations
    M LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/hixie/mixed/009-expected.txt
    M LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/zoom/text/zoom-hixie-mixed-009-expected.txt
    M LayoutTests/platform/win/TestExpectations
    M LayoutTests/svg/custom/display-table-caption-foreignObject.svg
    M LayoutTests/svg/custom/display-table-caption-inherit-foreignObject.xhtml
    M LayoutTests/svg/custom/use-on-use-with-child.svg
    M LayoutTests/svg/dom/SVGScriptElement/script-async-attr.svg
    M LayoutTests/svg/dom/SVGScriptElement/script-load-and-error-events.svg
    M LayoutTests/svg/dom/SVGScriptElement/script-onerror-bubbling.svg
    M LayoutTests/svg/dom/SVGScriptElement/script-reexecution.svg
    M LayoutTests/svg/dom/SVGScriptElement/script-type-attribute.svg
    M LayoutTests/svg/dom/smil-methods.svg
    A LayoutTests/svg/foreignObject/respect-block-margin-expected.html
    A LayoutTests/svg/foreignObject/respect-block-margin.html
    M LayoutTests/svg/hittest/svg-standalone-tooltip.svg
    M LayoutTests/svg/hixie/mixed/009.xml
    M LayoutTests/svg/zoom/page/zoom-hixie-mixed-009.xml
    M LayoutTests/svg/zoom/text/zoom-hixie-mixed-009.xml
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderLayer.cpp

  Log Message:
  -----------
  [LBSE] Assure <foreignObject> HTML descendants create a new formatting context
https://bugs.webkit.org/show_bug.cgi?id=245908

Reviewed by Rob Buis.

Fix mistake in svg/hixie/mixed/009.xml and its copies. A style sheet
applied a certain 'margin' value to all <div> elements, including the
one inside the <foreignObject>, which was unintentional. Now the testcase
behaves as expected in Firefox/Chrome, but is broken in Safari. With LBSE
the test works correctly: 'margin' is respected as intended on block-level
children that are direct children of <foreignObject>.

-> <foreignObject> needs to create a new formatting context for its descendants.
This finally fixes margin handling for block-children of <foreignObject> which
was broken since forever (at least 15 years) in WebKit.

Some further fixes are necessary to correctly compute clip rects for <foreignObject>.
<fO> should behaves like an absolutely positioned object -- but we failed
to honor that SVG2 requirement, when comuting clip rects in RenderLayer - fix that.

Enable some tests that were skipped because of bugs in the testcases themselves,
such as missing width/height attributes on <foreignObject> elements.

Covered by existing tests -- some tests will be fully fixed once zooming works, too.

* LayoutTests/platform/glib/TestExpectations: Skip new test (needs LBSE).
* LayoutTests/platform/win/TestExpectations: Ditto.
* LayoutTests/platform/mac-monterey-wk2-lbse-text/TestExpectations:
* LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/hixie/mixed/009-expected.txt:
* LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/zoom/text/zoom-hixie-mixed-009-expected.txt:
* LayoutTests/svg/custom/display-table-caption-foreignObject.svg:
* LayoutTests/svg/custom/display-table-caption-inherit-foreignObject.xhtml:
* LayoutTests/svg/custom/use-on-use-with-child.svg:
* LayoutTests/svg/dom/SVGScriptElement/script-async-attr.svg:
* LayoutTests/svg/dom/SVGScriptElement/script-load-and-error-events.svg:
* LayoutTests/svg/dom/SVGScriptElement/script-onerror-bubbling.svg:
* LayoutTests/svg/dom/SVGScriptElement/script-reexecution.svg:
* LayoutTests/svg/dom/SVGScriptElement/script-type-attribute.svg:
* LayoutTests/svg/dom/smil-methods.svg:
* LayoutTests/svg/foreignObject/respect-block-margin-expected.html: Added.
* LayoutTests/svg/foreignObject/respect-block-margin.html: Added. Always run this test with LBSE, broken in legacy.
* LayoutTests/svg/hittest/svg-standalone-tooltip.svg:
* LayoutTests/svg/hixie/mixed/009.xml:
* LayoutTests/svg/zoom/page/zoom-hixie-mixed-009.xml:
* LayoutTests/svg/zoom/text/zoom-hixie-mixed-009.xml:
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::createsNewFormattingContext const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateAncestorDependentState):
(WebCore::RenderLayer::calculateClipRects const):

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




More information about the webkit-changes mailing list