⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287610 in webkit


Ignore:
Timestamp:
Jan 5, 2022, 2:01:06 AM (5 years ago)
Author:
Martin Robinson
Message:

Change offsetParent to match spec change
​https://bugs.webkit.org/show_bug.cgi?id=161788
<rdar://problem/28230510>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt: Rebase test that fails differently now.
  • web-platform-tests/css/css-transforms/preserve-3d-flat-grouping-properties-containing-block-expected.txt: Ditto.
  • web-platform-tests/css/cssom-view/offsetParent_element_test.html: Increase the test coverage for this test case.
  • web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt: Part of this test now passes.

Source/WebCore:

No new tests. This is covered by new test statements in web-platform-tests/css/cssom-view/offsetParent_element_test.html.

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::offsetParent const): Update the offsetParent algorithm to return all elements
that create containing blocks for absolutely positioned items and not just positioned elements.

LayoutTests:

  • fast/clip/hit-test-with-clip-path.html: Rewrite this test to use getBoundingClientRect.
  • fast/forms/resources/common.js:

(searchCancelButtonPosition): Ditto.

  • fast/forms/search-transformed.html: Ditto.
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287607 r287610  
     12022-01-05  Martin Robinson  <mrobinson@webkit.org>
     2
     3        Change offsetParent to match spec change
     4        https://bugs.webkit.org/show_bug.cgi?id=161788
     5        <rdar://problem/28230510>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/clip/hit-test-with-clip-path.html: Rewrite this test to use getBoundingClientRect.
     10        * fast/forms/resources/common.js:
     11        (searchCancelButtonPosition): Ditto.
     12        * fast/forms/search-transformed.html: Ditto.
     13
    1142022-01-05  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/LayoutTests/fast/clip/hit-test-with-clip-path.html

    r279544 r287610  
    3939</div>
    4040<script>
    41 result.innerText += "\n" + document.elementFromPoint(candidate1.offsetLeft, candidate1.offsetTop).id;
     41let rect1 = candidate1.getBoundingClientRect();
     42result.innerText += "\n" + document.elementFromPoint(rect1.left, rect1.top).id;
    4243</script>
    4344
    … …  
    5152</div>
    5253<script>
    53 result.innerText += "\n" + document.elementFromPoint(candidate2.offsetLeft, candidate2.offsetTop).id;
     54let rect2 = candidate2.getBoundingClientRect();
     55result.innerText += "\n" + document.elementFromPoint(rect2.left, rect2.top).id;
    5456</script>
    5557
    … …  
    6668</div>
    6769<script>
    68 result.innerText += "\n" + document.elementFromPoint(candidate3.offsetLeft, candidate3.offsetTop).id;
     70let rect3 = candidate3.getBoundingClientRect();
     71result.innerText += "\n" + document.elementFromPoint(rect3.left, rect3.top).id;
    6972</script>
  • trunk/LayoutTests/fast/forms/resources/common.js

    r235893 r287610  
    107107function searchCancelButtonPosition(element, isRTL = false) {
    108108    var pos = {};
    109     pos.x = element.offsetLeft + (isRTL ? 9 : (element.offsetWidth - 9));
    110     pos.y = element.offsetTop + element.offsetHeight / 2;
     109    let rect = element.getBoundingClientRect();
     110    pos.x = rect.left + (isRTL ? 9 : (rect.width - 9));
     111    pos.y = rect.top + rect.height / 2;
    111112    return pos;
    112113}
  • trunk/LayoutTests/fast/forms/search-transformed.html

    r121008 r287610  
    2121        if (window.eventSender) {
    2222            var target = document.getElementById("target");
    23             var translationAmount = 50;
    2423            var cancelPos = searchCancelButtonPosition(target);
    25             eventSender.mouseMoveTo(cancelPos.x + translationAmount, cancelPos.y + translationAmount);
     24            eventSender.mouseMoveTo(cancelPos.x, cancelPos.y);
    2625            eventSender.mouseDown();
    2726            eventSender.mouseUp();
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r287609 r287610  
     12022-01-05  Martin Robinson  <mrobinson@webkit.org>
     2
     3        Change offsetParent to match spec change
     4        https://bugs.webkit.org/show_bug.cgi?id=161788
     5        <rdar://problem/28230510>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt: Rebase test that fails differently now.
     10        * web-platform-tests/css/css-transforms/preserve-3d-flat-grouping-properties-containing-block-expected.txt: Ditto.
     11        * web-platform-tests/css/cssom-view/offsetParent_element_test.html: Increase the test coverage for this test case.
     12        * web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt: Part of this test now passes.
     13
    1142022-01-05  Commit Queue  <commit-queue@webkit.org>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt

    r274620 r287610  
    11
    2 FAIL Measure Forced Layout assert_equals: 0 forced expected 0 but got 8
     2FAIL Measure Forced Layout assert_equals: spacer forced expected 8 but got 108
    33
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/preserve-3d-flat-grouping-properties-containing-block-expected.txt

    r282287 r287610  
    11
    22FAIL Preserve-3d element with a grouping property still a containing block assert_equals: expected Element node <div id="parentWithGrouping" style="transform-style: pres... but got Element node <body><div id="parentWithGrouping" style="transform-style...
    3 FAIL Preserve-3d element without a grouping property still a containing block assert_equals: expected Element node <div id="parentWithoutGrouping" style="transform-style: p... but got Element node <body><div id="parentWithGrouping" style="transform-style...
     3PASS Preserve-3d element without a grouping property still a containing block
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/offsetParent_element_test.html

    r254129 r287610  
    2525    position: absolute;
    2626}
     27
     28#transform-element {
     29    transform: translateX(10px);
     30}
     31
     32#perspective-element {
     33    perspective: 10px;
     34}
     35
     36#transform-style-preserve-3d-element {
     37    transform-style: preserve-3d;
     38}
     39
     40#filter-element {
     41    filter: opacity(25%);
     42}
     43
     44#contain-paint-element {
     45    contain: paint;
     46}
    2747</style>
    2848
    … …  
    3858<div id="absolute-element">
    3959    <div id="absolute-element-child"></div>
     60</div>
     61
     62<div id="transform-element">
     63    <div id="transform-element-child"></div>
     64</div>
     65
     66<div id="transform-style-preserve-3d-element">
     67    <div id="transform-style-preserve-3d-element-child"></div>
     68</div>
     69
     70<div id="perspective-element">
     71    <div id="perspective-element-child"></div>
     72</div>
     73
     74<div id="contain-paint-element">
     75    <div id="contain-paint-element-child"></div>
    4076</div>
    4177
    … …  
    123159    assert_equals(window.getComputedStyle(td_element).position,'static');
    124160    assert_equals(td_element.offsetParent,table_element);
     161
     162    let transform_element = document.getElementById('transform-element');
     163    assert_equals(transform_element.children[0].offsetParent, transform_element);
     164
     165    let perspective_element = document.getElementById('perspective-element');
     166    assert_equals(perspective_element.children[0].offsetParent, perspective_element);
     167
     168    let transform_style_preserve_3d_element = document.getElementById('transform-style-preserve-3d-element');
     169    assert_equals(transform_style_preserve_3d_element.children[0].offsetParent,
     170                  transform_style_preserve_3d_element);
     171
     172    let contain_paint_element = document.getElementById('contain-paint-element');
     173    assert_equals(contain_paint_element.children[0].offsetParent, contain_paint_element);
     174
     175
    125176}, "Valid the algorithm rule of offsetParent check step 2");
    126177
  • trunk/LayoutTests/imported/w3c/web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt

    r250276 r287610  
    11
    2 FAIL position assert_equals: offsetLeft expected 5 but got 15
     2FAIL position assert_equals: offsetTop expected 5 but got 0
    33
  • trunk/Source/WebCore/ChangeLog

    r287609 r287610  
     12022-01-05  Martin Robinson  <mrobinson@webkit.org>
     2
     3        Change offsetParent to match spec change
     4        https://bugs.webkit.org/show_bug.cgi?id=161788
     5        <rdar://problem/28230510>
     6
     7        Reviewed by Simon Fraser.
     8
     9        No new tests. This is covered by new test statements in web-platform-tests/css/cssom-view/offsetParent_element_test.html.
     10
     11        * rendering/RenderObject.cpp:
     12        (WebCore::RenderObject::offsetParent const): Update the offsetParent algorithm to return all elements
     13        that create containing blocks for absolutely positioned items and not just positioned elements.
     14
    1152022-01-05  Commit Queue  <commit-queue@webkit.org>
    216
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r286962 r287610  
    17051705    // Return the nearest ancestor element of A for which at least one of the following is
    17061706    // true and stop this algorithm if such an ancestor is found:
    1707     //     * The computed value of the position property is not static.
     1707    //     * The element is a containing block of absolutely-positioned descendants (regardless
     1708    //       of whether there are any absolutely-positioned descendants).
    17081709    //     * It is the HTML body element.
    17091710    //     * The computed value of the position property of A is static and the ancestor
    … …  
    17141715    float currZoom = style().effectiveZoom();
    17151716    auto current = parent();
    1716     while (current && (!current->element() || (!current->isPositioned() && !current->isBody()))) {
     1717    while (current && (!current->element() || (!current->canContainAbsolutelyPositionedObjects() && !current->isBody()))) {
    17171718        Element* element = current->element();
    17181719        if (!skipTables && element && (is<HTMLTableElement>(*element) || is<HTMLTableCellElement>(*element)))
Note: See TracChangeset for help on using the changeset viewer.