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

Nikolas Zimmermann noreply at github.com
Tue Nov 22 17:45:27 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7fd975ae74272051463b1f88a67cffdf7c5dfcc4
      https://github.com/WebKit/WebKit/commit/7fd975ae74272051463b1f88a67cffdf7c5dfcc4
  Author: Nikolas Zimmermann <nzimmermann at igalia.com>
  Date:   2022-11-22 (Tue, 22 Nov 2022)

  Changed paths:
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/mac-ventura-wk2-lbse-text/TestExpectations
    M LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/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 Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderObject.h

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

Reviewed by Simon Fraser.

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, and a specific new test that enforce LBSE usage so we
get coverage for this in EWS layout test runs, where LBSE is not explicitely
turned out (similar to the tests in svg/z-index, svg/compositing).

* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/mac-ventura-wk2-lbse-text/TestExpectations:
* LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/hixie/mixed/009-expected.txt:
* LayoutTests/platform/win/TestExpectations:
* 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.
* LayoutTests/svg/hittest/svg-standalone-tooltip.svg:
* LayoutTests/svg/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):
* Source/WebCore/rendering/RenderObject.h:
(WebCore::RenderObject::shouldUsePositionedClipping const):

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




More information about the webkit-changes mailing list