Changeset 164336 in webkit


Ignore:
Timestamp:
Feb 18, 2014 5:55:33 PM (10 years ago)
Author:
Simon Fraser
Message:

border-box clip-paths jump around when outline changes
https://bugs.webkit.org/show_bug.cgi?id=128929

Source/WebCore:

Reviewed by Dirk Schulze.

computeReferenceBox() for clip paths was using "rootRelativeBounds"
to position the border-box. This bounds is an enclosing bounds for
the layer and its descendants, including outlines and absolute descendants,
so it is not the correct box to use to offset the border-box.

The caller has offsetFromRoot(), which is the correct thing to use,
so use it.

Test: css3/masking/clip-path-root-relative-bounds.html

  • rendering/RenderLayer.cpp:

(WebCore::computeReferenceBox):
(WebCore::RenderLayer::setupClipPath):

LayoutTests:

Reviewed by Dirk Schulze.

Test comparing a border-box clip path with and without an outline.

  • css3/masking/clip-path-root-relative-bounds-expected.html: Added.
  • css3/masking/clip-path-root-relative-bounds.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r164332 r164336  
     12014-02-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        border-box clip-paths jump around when outline changes
     4        https://bugs.webkit.org/show_bug.cgi?id=128929
     5
     6        Reviewed by Dirk Schulze.
     7       
     8        Test comparing a border-box clip path with and without an outline.
     9
     10        * css3/masking/clip-path-root-relative-bounds-expected.html: Added.
     11        * css3/masking/clip-path-root-relative-bounds.html: Added.
     12
    1132014-02-18  James Craig  <jcraig@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r164332 r164336  
     12014-02-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        border-box clip-paths jump around when outline changes
     4        https://bugs.webkit.org/show_bug.cgi?id=128929
     5
     6        Reviewed by Dirk Schulze.
     7       
     8        computeReferenceBox() for clip paths was using "rootRelativeBounds"
     9        to position the border-box. This bounds is an enclosing bounds for
     10        the layer and its descendants, including outlines and absolute descendants,
     11        so it is not the correct box to use to offset the border-box.
     12       
     13        The caller has offsetFromRoot(), which is the correct thing to use,
     14        so use it.
     15
     16        Test: css3/masking/clip-path-root-relative-bounds.html
     17
     18        * rendering/RenderLayer.cpp:
     19        (WebCore::computeReferenceBox):
     20        (WebCore::RenderLayer::setupClipPath):
     21
    1222014-02-18  James Craig  <jcraig@apple.com>
    223
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r164275 r164336  
    37893789
    37903790template <class ReferenceBoxClipPathOperation>
    3791 static inline LayoutRect computeReferenceBox(const RenderObject& renderer, const ReferenceBoxClipPathOperation& clippingPath, const LayoutRect& rootRelativeBounds)
     3791static inline LayoutRect computeReferenceBox(const RenderObject& renderer, const ReferenceBoxClipPathOperation& clippingPath, const LayoutPoint& offsetFromRoot, const LayoutRect& rootRelativeBounds)
    37923792{
    37933793    LayoutRect referenceBox;
     
    37973797            case ContentBox:
    37983798                referenceBox = box.contentBoxRect();
    3799                 referenceBox.moveBy(rootRelativeBounds.location());
     3799                referenceBox.moveBy(offsetFromRoot);
    38003800                break;
    38013801            case PaddingBox:
    38023802                referenceBox = box.paddingBoxRect();
    3803                 referenceBox.moveBy(rootRelativeBounds.location());
     3803                referenceBox.moveBy(offsetFromRoot);
    38043804                break;
    38053805            // fill, stroke, view-box compute to border-box for HTML elements.
     
    38093809            case BorderBox:
    38103810                referenceBox = box.borderBoxRect();
    3811                 referenceBox.moveBy(rootRelativeBounds.location());
     3811                referenceBox.moveBy(offsetFromRoot);
    38123812                break;
    38133813            case MarginBox:
     
    38423842        ShapeClipPathOperation& clippingPath = toShapeClipPathOperation(*(style.clipPath()));
    38433843
    3844         LayoutRect referenceBox = computeReferenceBox(renderer(), clippingPath, rootRelativeBounds);
     3844        LayoutRect referenceBox = computeReferenceBox(renderer(), clippingPath, offsetFromRoot, rootRelativeBounds);
    38453845        context->save();
    38463846        context->clipPath(clippingPath.pathForReferenceRect(referenceBox), clippingPath.windRule());
     
    38513851        BoxClipPathOperation& clippingPath = toBoxClipPathOperation(*(style.clipPath()));
    38523852
    3853         LayoutRect referenceBox = computeReferenceBox(renderer(), clippingPath, rootRelativeBounds);
     3853        LayoutRect referenceBox = computeReferenceBox(renderer(), clippingPath, offsetFromRoot, rootRelativeBounds);
    38543854        // FIXME This does not properly compute the rounded corners as specified in all conditions.
    38553855        // https://bugs.webkit.org/show_bug.cgi?id=127982
Note: See TracChangeset for help on using the changeset viewer.