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

Changeset 150108 in webkit


Ignore:
Timestamp:
May 15, 2013, 3:54:24 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[CSSRegions] Implement offsetParent for elements inside named flow
​https://bugs.webkit.org/show_bug.cgi?id=113276

Source/WebCore:

In the offsetParent algorithm, the nearest ancestor search skips from the topmost named flow elements directly to the body element.
​http://dev.w3.org/csswg/css-regions/#cssomview-offset-attributes

As a result of this change, the DumpRenderTree tool would crash in
WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent when running the selecting-text-through-different-region-flows.html
test. The RenderObjects inside a flow are attached to the RenderFlowThread. However, the RenderFlowThread is attached to the
RenderView directly, meaning that we are going to bypass the <body>'s RenderObject while iterating the parents.

Patch by Radu Stavila <​stavila@adobe.com> on 2013-05-15
Reviewed by Darin Adler.

Tests: fast/regions/offsetParent-body-in-flow-thread.html

fast/regions/offsetParent-in-flow-thread.html

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::offsetParent):

LayoutTests:

Patch by Radu Stavila <​stavila@adobe.com> on 2013-05-15
Reviewed by Darin Adler.

In the offsetParent algorithm, the nearest ancestor search skips from the topmost named flow elements directly to the body element.

Added new test for offsetParent when body is flowed into a region.
Updated existing offsetParent test.

  • fast/regions/offsetParent-body-in-flow-thread-expected.txt: Added.
  • fast/regions/offsetParent-body-in-flow-thread.html: Added.
  • fast/regions/offsetParent-in-flow-thread-expected.txt:
  • fast/regions/offsetParent-in-flow-thread.html:
Location:
trunk
Files:
1 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r150097 r150108  
     12013-05-15  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSSRegions] Implement offsetParent for elements inside named flow
     4        https://bugs.webkit.org/show_bug.cgi?id=113276
     5
     6        Reviewed by Darin Adler.
     7
     8        In the offsetParent algorithm, the nearest ancestor search skips from the topmost named flow elements directly to the body element.
     9
     10        Added new test for offsetParent when body is flowed into a region.
     11        Updated existing offsetParent test.
     12
     13        * fast/regions/offsetParent-body-in-flow-thread-expected.txt: Added.
     14        * fast/regions/offsetParent-body-in-flow-thread.html: Added.
     15        * fast/regions/offsetParent-in-flow-thread-expected.txt:
     16        * fast/regions/offsetParent-in-flow-thread.html:
     17
    1182013-05-14  Hans Muller  <hmuller@adobe.com>
    219
  • trunk/LayoutTests/fast/regions/offsetParent-body-in-flow-thread.html

    r150107 r150108  
    44        <script src="../js/resources/js-test-pre.js"></script>
    55    </head>
     6
     7    <style>
     8
     9        #region {
     10            -webkit-flow-from: flow;
     11        }
     12
     13    </style>
     14
    615    <body>
    716        <script>
    8             description("Test offsetParent for elements inside a named flow.")
     17            description("Test offsetParent for body in a named flow.")
    918
     19            document.body.style.webkitFlowInto = "flow";
     20           
    1021            var article = document.createElement("div");
    1122            document.body.appendChild(article);
    12             article.style.webkitFlowInto = "flow";
    13             shouldBeNull("article.offsetParent");
     23            shouldBe("article.offsetParent", "document.body");
    1424
    1525            var chapter = document.createElement("div");
    1626            article.appendChild(chapter);
    17             shouldBeNull("chapter.offsetParent");
     27            shouldBe("chapter.offsetParent", "document.body");
    1828
    1929            article.style.position = "relative";
    … …  
    3141
    3242            tdChild.style.webkitFlowInto = "flow";
    33             shouldBeNull("tdChild.offsetParent");
     43            shouldBe("tdChild.offsetParent", "document.body");
     44
     45            shouldBeNull("document.body.offsetParent");
     46
     47            document.body.style.webkitFlowInto = null;
    3448        </script>
    3549        <script src="../js/resources/js-test-post.js"></script>
     50
     51        <div id="region"/>
    3652    </body>
    3753</html>
  • trunk/LayoutTests/fast/regions/offsetParent-in-flow-thread-expected.txt

    r146856 r150108  
    44
    55
    6 PASS article.offsetParent is null
    7 PASS chapter.offsetParent is null
     6PASS article.offsetParent is document.body
     7PASS chapter.offsetParent is document.body
    88PASS chapter.offsetParent is article
    99PASS tdChild.offsetParent is td
    10 PASS tdChild.offsetParent is null
     10PASS tdChild.offsetParent is document.body
     11PASS document.body.offsetParent is null
    1112PASS successfullyParsed is true
    1213
  • trunk/LayoutTests/fast/regions/offsetParent-in-flow-thread.html

    r146856 r150108  
    1111            document.body.appendChild(article);
    1212            article.style.webkitFlowInto = "flow";
    13             shouldBeNull("article.offsetParent");
     13            shouldBe("article.offsetParent", "document.body");
    1414
    1515            var chapter = document.createElement("div");
    1616            article.appendChild(chapter);
    17             shouldBeNull("chapter.offsetParent");
     17            shouldBe("chapter.offsetParent", "document.body");
    1818
    1919            article.style.position = "relative";
    … …  
    3131
    3232            tdChild.style.webkitFlowInto = "flow";
    33             shouldBeNull("tdChild.offsetParent");
     33            shouldBe("tdChild.offsetParent", "document.body");
     34
     35            shouldBeNull("document.body.offsetParent");
    3436        </script>
    3537        <script src="../js/resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r150107 r150108  
     12013-05-15  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSSRegions] Implement offsetParent for elements inside named flow
     4        https://bugs.webkit.org/show_bug.cgi?id=113276
     5
     6        In the offsetParent algorithm, the nearest ancestor search skips from the topmost named flow elements directly to the body element.
     7        http://dev.w3.org/csswg/css-regions/#cssomview-offset-attributes
     8
     9        As a result of this change, the DumpRenderTree tool would crash in
     10        WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent when running the selecting-text-through-different-region-flows.html
     11        test. The RenderObjects inside a flow are attached to the RenderFlowThread. However, the RenderFlowThread is attached to the
     12        RenderView directly, meaning that we are going to bypass the <body>'s RenderObject while iterating the parents.
     13
     14        Reviewed by Darin Adler.
     15
     16        Tests: fast/regions/offsetParent-body-in-flow-thread.html
     17               fast/regions/offsetParent-in-flow-thread.html
     18
     19        * rendering/RenderBoxModelObject.cpp:
     20        (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent):
     21        * rendering/RenderObject.cpp:
     22        (WebCore::RenderObject::offsetParent):
     23
    1242013-05-15  Darin Adler  <darin@apple.com>
    225
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r149653 r150108  
    497497            else if (isStickyPositioned())
    498498                referencePoint.move(stickyPositionOffset());
     499           
     500            // FIXME: The offset position for elements inside named flow threads is not correctly computed when the offsetParent is body
     501            // See https://bugs.webkit.org/show_bug.cgi?id=115899
     502           
     503            // CSS regions specification says that region flows should return the body element as their offsetParent.
     504            // Since we will bypass the body’s renderer anyway, just end the loop if we encounter a region flow (named flow thread).
     505            // See http://dev.w3.org/csswg/css-regions/#cssomview-offset-attributes
    499506            const RenderObject* curr = parent();
    500             while (curr != offsetParent) {
     507            while (curr != offsetParent && !curr->isRenderNamedFlowThread()) {
    501508                // FIXME: What are we supposed to do inside SVG content?
    502509                if (curr->isBox() && !curr->isTableRow())
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r149980 r150108  
    29882988    // chain return the nearest ancestor map HTML element and stop this algorithm.
    29892989    // FIXME: Implement!
    2990 
    2991     // FIXME: Stop the search at the flow thread boundary until we figure out the right
    2992     // behavior for elements inside a flow thread.
    2993     // https://bugs.webkit.org/show_bug.cgi?id=113276
    29942990   
    29952991    // Return the nearest ancestor element of A for which at least one of the following is
    … …  
    30153011        curr = curr->parent();
    30163012    }
    3017     return curr && curr->isBoxModelObject() && !curr->isRenderNamedFlowThread() ? toRenderBoxModelObject(curr) : 0;
     3013   
     3014    // CSS regions specification says that region flows should return the body element as their offsetParent.
     3015    if (curr && curr->isRenderNamedFlowThread())
     3016        curr = document()->body() ? document()->body()->renderer() : 0;
     3017   
     3018    return curr && curr->isBoxModelObject() ? toRenderBoxModelObject(curr) : 0;
    30183019}
    30193020
Note: See TracChangeset for help on using the changeset viewer.