Changeset 131402 in webkit


Ignore:
Timestamp:
Oct 15, 2012 8:26:49 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Support for background-clip:content-box and padding-box with border-radius
https://bugs.webkit.org/show_bug.cgi?id=23166

Patch by Vlad Grecescu <igrecesc@adobe.com>, Douglas Stockwell <dstockwell@chromium.org> on 2012-10-15
Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/css/background-clip-radius-values.html

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::clipRoundedInnerRect):
(WebCore):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):

  • rendering/RenderBoxModelObject.h:

LayoutTests:

  • fast/css/background-clip-radius-values-expected.png: Added.
  • fast/css/background-clip-radius-values-expected.txt: Added.
  • fast/css/background-clip-radius-values.html: Added.
  • platform/chromium-linux/fast/css/background-clip-radius-values-expected.png: Added.
  • platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-clip-002-expected.png:
  • platform/chromium/TestExpectations:
  • platform/mac/ietestcenter/css3/bordersbackgrounds/border-radius-clip-002-expected.png: Added.
  • platform/qt/TestExpectations:
  • platform/efl/TestExpectations:
Location:
trunk
Files:
5 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r131400 r131402  
     12012-10-15  Vlad Grecescu  <igrecesc@adobe.com>, Douglas Stockwell  <dstockwell@chromium.org>
     2
     3        Support for background-clip:content-box and padding-box with border-radius
     4        https://bugs.webkit.org/show_bug.cgi?id=23166
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/css/background-clip-radius-values-expected.png: Added.
     9        * fast/css/background-clip-radius-values-expected.txt: Added.
     10        * fast/css/background-clip-radius-values.html: Added.
     11        * platform/chromium-linux/fast/css/background-clip-radius-values-expected.png: Added.
     12        * platform/chromium-linux/ietestcenter/css3/bordersbackgrounds/border-radius-clip-002-expected.png:
     13        * platform/chromium/TestExpectations:
     14        * platform/mac/ietestcenter/css3/bordersbackgrounds/border-radius-clip-002-expected.png: Added.
     15        * platform/qt/TestExpectations:
     16        * platform/efl/TestExpectations:
     17
    1182012-10-15  Kent Tamura  <tkent@chromium.org>
    219
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r131396 r131402  
    40374037webkit.org/b/98686 editing/pasteboard/data-transfer-items.html [ Failure ]
    40384038
     4039webkit.org/b/23166 [ Android Mac Win ] fast/css/background-clip-radius-values.html [ Pass ImageOnlyFailure ]
     4040webkit.org/b/23166 [ Android Mac Win ] ietestcenter/css3/bordersbackgrounds/border-radius-clip-002.htm [ Pass ImageOnlyFailure ]
     4041
    40394042webkit.org/b/98699 [ Lion ] fast/writing-mode/vertical-subst-font-vert-no-dflt.html [ Crash ]
    40404043webkit.org/b/98811 [ Mac ] fast/transforms/transformed-focused-text-input.html [ Pass ImageOnlyFailure ]
  • trunk/LayoutTests/platform/efl/TestExpectations

    r131378 r131402  
    15291529webkit.org/b/10890 fast/selectors/unqualified-hover-strict.html [ Failure Pass ]
    15301530
     1531# May need rebaseline
     1532webkit.org/b/23166 fast/css/background-clip-radius-values.html [ Pass ImageOnlyFailure ]
     1533webkit.org/b/23166 ietestcenter/css3/bordersbackgrounds/border-radius-clip-002.htm [ Pass ImageOnlyFailure ]
     1534
    15311535# Regressions after r130699
    15321536webkit.org/b/98729 fast/css/import-style-update.html [ Failure ]
  • trunk/LayoutTests/platform/qt/TestExpectations

    r131378 r131402  
    24192419webkit.org/b/94004 css2.1/20110323/c541-word-sp-000.htm [ ImageOnlyFailure ]
    24202420
     2421# May need rebaseline
     2422webkit.org/b/23166 fast/css/background-clip-radius-values.html [ Pass ImageOnlyFailure ]
     2423webkit.org/b/23166 ietestcenter/css3/bordersbackgrounds/border-radius-clip-002.htm [ Pass ImageOnlyFailure ]
     2424
    24212425# Added by bug 89826
    24222426webkit.org/b/94005 css2.1/20110323/word-spacing-remove-space-003.htm [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r131397 r131402  
     12012-10-15  Vlad Grecescu  <igrecesc@adobe.com>, Douglas Stockwell  <dstockwell@chromium.org>
     2
     3        Support for background-clip:content-box and padding-box with border-radius
     4        https://bugs.webkit.org/show_bug.cgi?id=23166
     5
     6        Reviewed by Simon Fraser.
     7
     8        Test: fast/css/background-clip-radius-values.html
     9
     10        * rendering/RenderBoxModelObject.cpp:
     11        (WebCore::RenderBoxModelObject::clipRoundedInnerRect):
     12        (WebCore):
     13        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     14        * rendering/RenderBoxModelObject.h:
     15
    1162012-10-15  Byungwoo Lee  <bw80.lee@samsung.com>
    217
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r131111 r131402  
    660660}
    661661
     662void RenderBoxModelObject::clipRoundedInnerRect(GraphicsContext * context, const LayoutRect& rect, const RoundedRect& clipRect)
     663{
     664    if (clipRect.isRenderable())
     665        context->addRoundedRectClip(clipRect);
     666    else {
     667        // We create a rounded rect for each of the corners and clip it, while making sure we clip opposing corners together.
     668        if (!clipRect.radii().topLeft().isEmpty() || !clipRect.radii().bottomRight().isEmpty()) {
     669            IntRect topCorner(clipRect.rect().x(), clipRect.rect().y(), rect.maxX() - clipRect.rect().x(), rect.maxY() - clipRect.rect().y());
     670            RoundedRect::Radii topCornerRadii;
     671            topCornerRadii.setTopLeft(clipRect.radii().topLeft());
     672            context->addRoundedRectClip(RoundedRect(topCorner, topCornerRadii));
     673
     674            IntRect bottomCorner(rect.x(), rect.y(), clipRect.rect().maxX() - rect.x(), clipRect.rect().maxY() - rect.y());
     675            RoundedRect::Radii bottomCornerRadii;
     676            bottomCornerRadii.setBottomRight(clipRect.radii().bottomRight());
     677            context->addRoundedRectClip(RoundedRect(bottomCorner, bottomCornerRadii));
     678        }
     679
     680        if (!clipRect.radii().topRight().isEmpty() || !clipRect.radii().bottomLeft().isEmpty()) {
     681            IntRect topCorner(rect.x(), clipRect.rect().y(), clipRect.rect().maxX() - rect.x(), rect.maxY() - clipRect.rect().y());
     682            RoundedRect::Radii topCornerRadii;
     683            topCornerRadii.setTopRight(clipRect.radii().topRight());
     684            context->addRoundedRectClip(RoundedRect(topCorner, topCornerRadii));
     685
     686            IntRect bottomCorner(clipRect.rect().x(), rect.y(), rect.maxX() - clipRect.rect().x(), clipRect.rect().maxY() - rect.y());
     687            RoundedRect::Radii bottomCornerRadii;
     688            bottomCornerRadii.setBottomLeft(clipRect.radii().bottomLeft());
     689            context->addRoundedRectClip(RoundedRect(bottomCorner, bottomCornerRadii));
     690        }
     691    }
     692}
     693
    662694static LayoutRect backgroundRectAdjustedForBleedAvoidance(GraphicsContext* context, const LayoutRect& borderRect, BackgroundBleedAvoidance bleedAvoidance)
    663695{
     
    750782    }
    751783
    752     bool clipToBorderRadius = hasRoundedBorder && bleedAvoidance != BackgroundBleedUseTransparencyLayer;
     784    // BorderFillBox radius clipping is taken care of by BackgroundBleedUseTransparencyLayer
     785    bool clipToBorderRadius = hasRoundedBorder && !(isBorderFill && bleedAvoidance == BackgroundBleedUseTransparencyLayer);
    753786    GraphicsContextStateSaver clipToBorderStateSaver(*context, clipToBorderRadius);
    754787    if (clipToBorderRadius) {
    755         RoundedRect border = getBackgroundRoundedRect(backgroundRectAdjustedForBleedAvoidance(context, rect, bleedAvoidance), box, boxSize.width(), boxSize.height(), includeLeftEdge, includeRightEdge);
    756         context->addRoundedRectClip(border);
     788        LayoutRect adjustedRect = isBorderFill ? backgroundRectAdjustedForBleedAvoidance(context, rect, bleedAvoidance) : rect;
     789        RoundedRect border = getBackgroundRoundedRect(adjustedRect, box, boxSize.width(), boxSize.height(), includeLeftEdge, includeRightEdge);
     790
     791        // Clip to the padding or content boxes as necessary.
     792        if (bgLayer->clip() == ContentFillBox) {
     793            border = style()->getRoundedInnerBorderFor(border.rect(),
     794                paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), includeLeftEdge, includeRightEdge);
     795        } else if (bgLayer->clip() == PaddingFillBox)
     796            border = style()->getRoundedInnerBorderFor(border.rect(), includeLeftEdge, includeRightEdge);
     797
     798        clipRoundedInnerRect(context, rect, border);
    757799    }
    758800   
     
    782824    if (bgLayer->clip() == PaddingFillBox || bgLayer->clip() == ContentFillBox) {
    783825        // Clip to the padding or content boxes as necessary.
    784         bool includePadding = bgLayer->clip() == ContentFillBox;
    785         LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : ZERO_LAYOUT_UNIT),
    786                                    scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : ZERO_LAYOUT_UNIT),
    787                                    scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : ZERO_LAYOUT_UNIT),
    788                                    scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : ZERO_LAYOUT_UNIT));
    789         backgroundClipStateSaver.save();
    790         if (clipToBorderRadius && includePadding) {
    791             RoundedRect rounded = getBackgroundRoundedRect(clipRect, box, boxSize.width(), boxSize.height(), includeLeftEdge, includeRightEdge);
    792             context->addRoundedRectClip(rounded);
    793         } else
     826        if (!clipToBorderRadius) {
     827            bool includePadding = bgLayer->clip() == ContentFillBox;
     828            LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : ZERO_LAYOUT_UNIT),
     829                scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : ZERO_LAYOUT_UNIT),
     830                scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : ZERO_LAYOUT_UNIT),
     831                scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : ZERO_LAYOUT_UNIT));
     832            backgroundClipStateSaver.save();
    794833            context->clip(clipRect);
     834        }
    795835    } else if (bgLayer->clip() == TextFillBox) {
    796836        // We have to draw our text into a mask that can then be used to clip background drawing.
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r131231 r131402  
    286286        bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
    287287
     288    void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const RoundedRect& clipRect);
     289
    288290    void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
    289291                               BoxSide, bool firstEdgeMatches, bool secondEdgeMatches);
Note: See TracChangeset for help on using the changeset viewer.