Changeset 168286 in webkit


Ignore:
Timestamp:
May 5, 2014 7:47:33 AM (10 years ago)
Author:
abucur@adobe.com
Message:

[CSSRegions] Slider displayed wrong in regions
https://bugs.webkit.org/show_bug.cgi?id=132243

Reviewed by Mihnea Ovidenie.

Source/WebCore:
In case a box didn't have a range, getRegionRangeForBox was searching for
the top-most unplittable ancestor. This is not correct in every case. It's
possible to have a box with range that has children without ranges (e.g. an
absolutely positioned inline box with shadow descendants).

I've modified getRegionRangeForBox to search for the first ancestor that
has a cached range and use that instead of looking for an unsplittable box.
The range of the box is the region at the top of the box, clamped by the
range of the ancestor. This will be correct all the time once all the layout
systems are region range aware and are able to cache it.

Test: fast/regions/positioned-slider-in-regions.html

  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::hasRegionRangeForBox):
(WebCore::RenderFlowThread::getRegionRangeForBox):

  • rendering/RenderFlowThread.h:

LayoutTests:
Tests that the thumb of positioned slider inside regions is correctly painted.

  • fast/regions/positioned-slider-in-regions-expected.html: Added.
  • fast/regions/positioned-slider-in-regions.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r168275 r168286  
     12014-05-05  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSSRegions] Slider displayed wrong in regions
     4        https://bugs.webkit.org/show_bug.cgi?id=132243
     5
     6        Reviewed by Mihnea Ovidenie.
     7
     8        Tests that the thumb of positioned slider inside regions is correctly painted.
     9
     10        * fast/regions/positioned-slider-in-regions-expected.html: Added.
     11        * fast/regions/positioned-slider-in-regions.html: Added.
     12
    1132014-05-05  Xabier Rodriguez Calvar  <calvaris@igalia.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r168263 r168286  
     12014-05-05  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSSRegions] Slider displayed wrong in regions
     4        https://bugs.webkit.org/show_bug.cgi?id=132243
     5
     6        Reviewed by Mihnea Ovidenie.
     7
     8        In case a box didn't have a range, getRegionRangeForBox was searching for
     9        the top-most unplittable ancestor. This is not correct in every case. It's
     10        possible to have a box with range that has children without ranges (e.g. an
     11        absolutely positioned inline box with shadow descendants).
     12
     13        I've modified getRegionRangeForBox to search for the first ancestor that
     14        has a cached range and use that instead of looking for an unsplittable box.
     15        The range of the box is the region at the top of the box, clamped by the
     16        range of the ancestor. This will be correct all the time once all the layout
     17        systems are region range aware and are able to cache it.
     18
     19        Test: fast/regions/positioned-slider-in-regions.html
     20
     21        * rendering/RenderFlowThread.cpp:
     22        (WebCore::RenderFlowThread::hasRegionRangeForBox):
     23        (WebCore::RenderFlowThread::getRegionRangeForBox):
     24        * rendering/RenderFlowThread.h:
     25
    1262014-05-05  Andrei Bucur  <abucur@adobe.com>
    227
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r168043 r168286  
    748748}
    749749
     750bool RenderFlowThread::hasRegionRangeForBox(const RenderBox* box) const
     751{
     752    ASSERT(box);
     753
     754    if (m_regionRangeMap.contains(box))
     755        return true;
     756
     757    InlineElementBox* boxWrapper = box->inlineBoxWrapper();
     758    if (boxWrapper && boxWrapper->root().containingRegion())
     759        return true;
     760
     761    return false;
     762}
     763
    750764bool RenderFlowThread::getRegionRangeForBoxFromCachedInfo(const RenderBox* box, RenderRegion*& startRegion, RenderRegion*& endRegion) const
    751765{
     
    787801    // If the unsplittable box has region range, then the start and end region for the box
    788802    // should be equal with the region for the unsplittable box if any.
    789     RenderBox* topMostUnsplittable = nullptr;
    790803    RenderBox* cb = const_cast<RenderBox*>(box);
    791     while (!cb->isRenderFlowThread()) {
    792         if (cb->isUnsplittableForPagination())
    793             topMostUnsplittable = cb;
     804    RenderBox* cbToUse = nullptr;
     805    while (!cb->isRenderFlowThread() && !cbToUse) {
     806        // FIXME: Use the containingBlock() value once we patch all the layout systems to be region range aware
     807        // (e.g. if we use containingBlock() the shadow controls of a video element won't get the range from the
     808        // video box because it's not a block; they need to be patched separately).
    794809        ASSERT(cb->parent());
    795810        cb = cb->parent()->enclosingBox();
    796811        ASSERT(cb);
    797     }
    798 
    799     if (topMostUnsplittable) {
    800         if (getRegionRangeForBoxFromCachedInfo(topMostUnsplittable, startRegion, endRegion)) {
    801             ASSERT(endRegion == startRegion);
    802             return true;
    803         }
     812
     813        if (hasRegionRangeForBox(cb))
     814            cbToUse = cb;
     815    }
     816
     817    // If a box doesn't have a cached region range it usually means the box belongs to a line so startRegion should be equal with endRegion.
     818    // FIXME: Find the cases when this startRegion should not be equal with endRegion and make sure these boxes have cached region ranges.
     819    if (cbToUse) {
     820        startRegion = endRegion = const_cast<RenderFlowThread*>(this)->regionAtBlockOffset(cbToUse, box->offsetFromLogicalTopOfFirstPage(), true, DisallowRegionAutoGeneration);
     821        return true;
    804822    }
    805823
  • trunk/Source/WebCore/rendering/RenderFlowThread.h

    r167930 r168286  
    142142    virtual void setRegionRangeForBox(const RenderBox*, RenderRegion*, RenderRegion*);
    143143    bool getRegionRangeForBox(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const;
    144     bool hasRegionRangeForBox(const RenderBox* box) const { ASSERT(box); return m_regionRangeMap.contains(box); }
     144    bool hasRegionRangeForBox(const RenderBox*) const;
    145145
    146146    // Check if the object is in region and the region is part of this flow thread.
Note: See TracChangeset for help on using the changeset viewer.