Changeset 165130 in webkit


Ignore:
Timestamp:
Mar 5, 2014 2:02:55 PM (10 years ago)
Author:
stavila@adobe.com
Message:

[CSS Regions] Scrollable regions
https://bugs.webkit.org/show_bug.cgi?id=129301

Reviewed by David Hyatt.

Source/WebCore:

Named flow fragments do not inherit the overflow property from the fragment container.
When asked if the flow thread content should be clipped, the named flow fragments
will respond using the overflow property of the named flow fragment container.

When painting the flow thread layer inside the region, the scrolled content offset of
the region must be used to offset the flow thread's layer.

Tests: fast/regions/scrollable-last-region.html

fast/regions/scrollable-single-region-bt.html
fast/regions/scrollable-single-region-lr.html
fast/regions/scrollable-single-region-relative-element.html
fast/regions/scrollable-single-region-rl.html
fast/regions/scrollable-single-region.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::mapLayerClipRectsToFragmentationLayer):
(WebCore::RenderLayer::calculateClipRects):

  • rendering/RenderNamedFlowFragment.cpp:

(WebCore::RenderNamedFlowFragment::createStyle):
(WebCore::RenderNamedFlowFragment::shouldClipFlowThreadContent):

  • rendering/RenderNamedFlowFragment.h:
  • rendering/RenderNamedFlowThread.cpp:

(WebCore::RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment):

  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::shouldClipFlowThreadContent):

  • rendering/RenderRegion.h:

LayoutTests:

Added tests for scrolling elements flowed into regions.

  • fast/regions/scrollable-last-region-expected.html: Added.
  • fast/regions/scrollable-last-region.html: Added.
  • fast/regions/scrollable-single-region-bt-expected.html: Added.
  • fast/regions/scrollable-single-region-bt.html: Added.
  • fast/regions/scrollable-single-region-expected.html: Added.
  • fast/regions/scrollable-single-region-lr-expected.html: Added.
  • fast/regions/scrollable-single-region-lr.html: Added.
  • fast/regions/scrollable-single-region-relative-element-expected.html: Added.
  • fast/regions/scrollable-single-region-relative-element.html: Added.
  • fast/regions/scrollable-single-region-rl-expected.html: Added.
  • fast/regions/scrollable-single-region-rl.html: Added.
  • fast/regions/scrollable-single-region.html: Added.
Location:
trunk
Files:
12 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r165127 r165130  
     12014-03-05  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSS Regions] Scrollable regions
     4        https://bugs.webkit.org/show_bug.cgi?id=129301
     5
     6        Reviewed by David Hyatt.
     7
     8        Added tests for scrolling elements flowed into regions.
     9
     10        * fast/regions/scrollable-last-region-expected.html: Added.
     11        * fast/regions/scrollable-last-region.html: Added.
     12        * fast/regions/scrollable-single-region-bt-expected.html: Added.
     13        * fast/regions/scrollable-single-region-bt.html: Added.
     14        * fast/regions/scrollable-single-region-expected.html: Added.
     15        * fast/regions/scrollable-single-region-lr-expected.html: Added.
     16        * fast/regions/scrollable-single-region-lr.html: Added.
     17        * fast/regions/scrollable-single-region-relative-element-expected.html: Added.
     18        * fast/regions/scrollable-single-region-relative-element.html: Added.
     19        * fast/regions/scrollable-single-region-rl-expected.html: Added.
     20        * fast/regions/scrollable-single-region-rl.html: Added.
     21        * fast/regions/scrollable-single-region.html: Added.
     22
    1232014-03-05  Zalan Bujtas  <zalan@apple.com>
    224
  • trunk/Source/WebCore/ChangeLog

    r165127 r165130  
     12014-03-05  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSS Regions] Scrollable regions
     4        https://bugs.webkit.org/show_bug.cgi?id=129301
     5
     6        Reviewed by David Hyatt.
     7
     8        Named flow fragments do not inherit the overflow property from the fragment container.
     9        When asked if the flow thread content should be clipped, the named flow fragments
     10        will respond using the overflow property of the named flow fragment container.
     11
     12        When painting the flow thread layer inside the region, the scrolled content offset of
     13        the region must be used to offset the flow thread's layer.
     14
     15        Tests: fast/regions/scrollable-last-region.html
     16               fast/regions/scrollable-single-region-bt.html
     17               fast/regions/scrollable-single-region-lr.html
     18               fast/regions/scrollable-single-region-relative-element.html
     19               fast/regions/scrollable-single-region-rl.html
     20               fast/regions/scrollable-single-region.html
     21
     22        * rendering/RenderLayer.cpp:
     23        (WebCore::RenderLayer::mapLayerClipRectsToFragmentationLayer):
     24        (WebCore::RenderLayer::calculateClipRects):
     25        * rendering/RenderNamedFlowFragment.cpp:
     26        (WebCore::RenderNamedFlowFragment::createStyle):
     27        (WebCore::RenderNamedFlowFragment::shouldClipFlowThreadContent):
     28        * rendering/RenderNamedFlowFragment.h:
     29        * rendering/RenderNamedFlowThread.cpp:
     30        (WebCore::RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment):
     31        * rendering/RenderRegion.cpp:
     32        (WebCore::RenderRegion::shouldClipFlowThreadContent):
     33        * rendering/RenderRegion.h:
     34
    1352014-03-05  Zalan Bujtas  <zalan@apple.com>
    236
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r165127 r165130  
    52915291    LayoutPoint portionLocation = flowThreadPortionRect.location();
    52925292    LayoutRect regionContentBox = namedFlowFragment->fragmentContainer().contentBoxRect();
    5293     LayoutSize moveOffset = portionLocation - regionContentBox.location();
     5293    IntSize scrolledContentOffset = namedFlowFragment->fragmentContainer().hasOverflowClip() ? namedFlowFragment->fragmentContainer().scrolledContentOffset() : IntSize();
     5294    LayoutSize moveOffset = portionLocation - regionContentBox.location() + scrolledContentOffset;
    52945295
    52955296    ClipRect newOverflowClipRect = clipRects.overflowClipRect();
     
    67876788    LayoutRect regionContentBox = toRenderBox(region->layerOwner()).contentBoxRect();
    67886789    LayoutSize moveOffset = region->flowThreadPortionLocation() - (paintOffset + regionContentBox.location());
     6790    if (region->fragmentContainer().hasOverflowClip())
     6791        moveOffset += region->fragmentContainer().scrolledContentOffset();
     6792   
    67896793    IntPoint adjustedPaintOffset = roundedIntPoint(-moveOffset);
    67906794    paintDirtyRect.move(moveOffset);
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp

    r164988 r165130  
    6363    style.get().setRegionThread(parentStyle.regionThread());
    6464    style.get().setRegionFragment(parentStyle.regionFragment());
    65     style.get().setOverflowX(parentStyle.overflowX());
    66     style.get().setOverflowY(parentStyle.overflowY());
    6765#if ENABLE(CSS_SHAPES) && ENABLE(CSS_SHAPE_INSIDE)
    6866    style.get().setShapeInside(parentStyle.shapeInside());
     
    246244    ASSERT(fragmentContainer().layer());
    247245    return *fragmentContainer().layer();
     246}
     247
     248bool RenderNamedFlowFragment::shouldClipFlowThreadContent() const
     249{
     250    if (fragmentContainer().hasOverflowClip())
     251        return true;
     252   
     253    return isLastRegion() && (style().regionFragment() == BreakRegionFragment);
    248254}
    249255
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h

    r164988 r165130  
    6767    RenderBlockFlow& fragmentContainer() const;
    6868    RenderLayer& fragmentContainerLayer() const;
     69   
     70    virtual bool shouldClipFlowThreadContent() const override;
    6971
    7072    bool isPseudoElementRegion() const { return parent() && parent()->isPseudoElement(); }
  • trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp

    r164988 r165130  
    298298    // Now flip it again.
    299299    flipForWritingModeLocalCoordinates(visualOverflowRect);
     300   
     301    // Take the scrolled offset of the region into consideration.
     302    RenderBlockFlow& fragmentContainer = fragment.fragmentContainer();
     303    if (fragmentContainer.hasOverflowClip()) {
     304        IntSize scrolledContentOffset = fragmentContainer.scrolledContentOffset();
     305        if (style().isFlippedBlocksWritingMode())
     306            scrolledContentOffset = -scrolledContentOffset;
     307       
     308        visualOverflowRect.inflateX(scrolledContentOffset.width());
     309        visualOverflowRect.inflateY(scrolledContentOffset.height());
     310    }
    300311   
    301312    // Layers are in physical coordinates so the origin must be moved to the physical top-left of the flowthread.
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r164988 r165130  
    203203bool RenderRegion::shouldClipFlowThreadContent() const
    204204{
    205     if (hasOverflowClip())
    206         return true;
    207 
    208     // regionFragment is CSSRegions specific therefore we take it into account only in these cases.
    209     return isRenderNamedFlowFragment() ? isLastRegion() && style().regionFragment() == BreakRegionFragment : false;
     205    return hasOverflowClip();
    210206}
    211207
  • trunk/Source/WebCore/rendering/RenderRegion.h

    r164988 r165130  
    7878    bool isFirstRegion() const;
    7979    bool isLastRegion() const;
    80     bool shouldClipFlowThreadContent() const;
     80    virtual bool shouldClipFlowThreadContent() const;
    8181
    8282    // These methods represent the width and height of a "page" and for a RenderRegion they are just the
Note: See TracChangeset for help on using the changeset viewer.