LayoutTests/ChangeLog

 12012-03-24 Vlad Grecescu <igrecesc@adobe.com>
 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 NOBODY (OOPS!).
 7
 8 * fast/css/background-clip-radius-values-expected.txt: Added.
 9 * fast/css/background-clip-radius-values.html: Added.
 10 * platform/win/fast/css/background-clip-radius-values-expected.png: Added.
 11
1122012-03-16 Yoshifumi Inoue <yosin@chromium.org>
213
314 [Forms] label.form attribute doesn't work

LayoutTests/fast/css/background-clip-radius-values-expected.txt

 1
 2
 3

LayoutTests/fast/css/background-clip-radius-values.html

 1<html>
 2<head>
 3<title>Testing Background clip values</title>
 4<style type="text/css">
 5div {
 6 display:inline-block;
 7 border: 10px solid rgba(128, 64, 64, 0.4);
 8 border-radius: 10px 30px;
 9 background-color:green;
 10 width: 100px;
 11 height: 100px;
 12 padding: 10px;
 13 margin: 10px;
 14}
 15
 16.content-box {
 17 background-clip: content-box;
 18}
 19.padding-box {
 20 background-clip: padding-box;
 21}
 22.border-box {
 23 background-clip: border-box;
 24}
 25
 26.tl {
 27 border-top-left-radius: 500px;
 28}
 29
 30.tr {
 31 border-top-right-radius: 500px;
 32}
 33
 34.bl {
 35 border-bottom-left-radius: 500px;
 36}
 37
 38.br {
 39 border-bottom-right-radius: 500px;
 40}
 41
 42.bigradii {
 43 border-top-left-radius: 130px 50px;
 44 border-bottom-left-radius: 50px 50px;
 45 border-top-right-radius: 10px 50px;
 46 border-bottom-right-radius: 50px 50px;
 47}
 48</style>
 49<script>
 50if (window.layoutTestController)
 51 layoutTestController.dumpAsText(true);
 52
 53</script>
 54</head>
 55<body>
 56<div class="content-box"></div>
 57<div class="padding-box"></div>
 58<div class="content-box tl br"></div>
 59<div class="padding-box tl br"></div>
 60<br>
 61<div class="content-box tr bl"></div>
 62<div class="padding-box tr bl"></div>
 63<div class="content-box tl"></div>
 64<div class="padding-box br"></div>
 65<br>
 66<div class="content-box tr"></div>
 67<div class="padding-box bl"></div>
 68<div class="content-box bigradii"></div>
 69<div class="padding-box bigradii"></div>
 70
 71</body>
 72</html>

LayoutTests/platform/win/fast/css/background-clip-radius-values-expected.png

Exception raised during decoding git binary patch:
Error: git binary content does not match index 0000000000000000000000000000000000000000
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1023:in `extract_contents_from_git_binary_literal_chunk'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1042:in `extract_contents_from_remote'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:717:in `initialize'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `new'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `block in parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `collect'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:25:in `prettify'
/var/www/html/PrettyPatch/prettify.rb:30:in `<main>'

Source/WebCore/ChangeLog

 12012-03-24 Vlad Grecescu <igrecesc@adobe.com>
 2
 3 Support for background-clip:content-box and padding-box with border-radius in non-complex cases
 4 https://bugs.webkit.org/show_bug.cgi?id=23166
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Test: fast/css/background-clip-radius-values.html
 9
 10 * rendering/RenderBoxModelObject.cpp:
 11 (WebCore::RenderBoxModelObject::paintFillLayerExtended):
 12 (WebCore::RenderBoxModelObject::clipComplexRoundedRect): Added
 13 * rendering/RenderBoxModelObject.h:
 14
1152012-03-16 Gavin Peters <gavinp@chromium.org>
216
317 Add asserts and improve logging in PageCache.

Source/WebCore/rendering/RenderBoxModelObject.cpp

@@RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor
634634 return border;
635635}
636636
 637void RenderBoxModelObject::clipRoundedInnerRect(GraphicsContext * context, const LayoutRect& rect, const RoundedRect& clipRect)
 638{
 639 if (clipRect.isRenderable())
 640 context->addRoundedRectClip(clipRect);
 641 else {
 642 // We create a rounded rect for each of the corners and clip it, while making sure we clip opposing corners together.
 643 if (!clipRect.radii().topLeft().isEmpty() || !clipRect.radii().bottomRight().isEmpty()) {
 644 LayoutRect topCorner(clipRect.rect().x(), clipRect.rect().y(), rect.maxX() - clipRect.rect().x(), rect.maxY() - clipRect.rect().y());
 645 RoundedRect::Radii topCornerRadii;
 646 topCornerRadii.setTopLeft(clipRect.radii().topLeft());
 647 context->addRoundedRectClip(RoundedRect(topCorner, topCornerRadii));
 648
 649 LayoutRect bottomCorner(rect.x(), rect.y(), clipRect.rect().maxX() - rect.x(), clipRect.rect().maxY() - rect.y());
 650 RoundedRect::Radii bottomCornerRadii;
 651 bottomCornerRadii.setBottomRight(clipRect.radii().bottomRight());
 652 context->addRoundedRectClip(RoundedRect(bottomCorner, bottomCornerRadii));
 653 }
 654 if (!clipRect.radii().topRight().isEmpty() || !clipRect.radii().bottomLeft().isEmpty()) {
 655 LayoutRect topCorner(rect.x(), clipRect.rect().y(), clipRect.rect().maxX() - rect.x(), rect.maxY() - clipRect.rect().y());
 656 RoundedRect::Radii topCornerRadii;
 657 topCornerRadii.setTopRight(clipRect.radii().topRight());
 658 context->addRoundedRectClip(RoundedRect(topCorner, topCornerRadii));
 659
 660 LayoutRect bottomCorner(clipRect.rect().x(), rect.y(), rect.maxX() - clipRect.rect().x(), clipRect.rect().maxY() - rect.y());
 661 RoundedRect::Radii bottomCornerRadii;
 662 bottomCornerRadii.setBottomLeft(clipRect.radii().bottomLeft());
 663 context->addRoundedRectClip(RoundedRect(bottomCorner, bottomCornerRadii));
 664 }
 665 }
 666}
 667
637668static LayoutRect backgroundRectAdjustedForBleedAvoidance(GraphicsContext* context, const LayoutRect& borderRect, BackgroundBleedAvoidance bleedAvoidance)
638669{
639670 if (bleedAvoidance != BackgroundBleedShrinkBackground)

@@void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
724755 return;
725756 }
726757
727  bool clipToBorderRadius = hasRoundedBorder && bleedAvoidance != BackgroundBleedUseTransparencyLayer;
 758 // BorderFillBox radius clipping is taken care of by BackgroundBleedUseTransparencyLayer
 759 bool clipToBorderRadius = hasRoundedBorder && !(isBorderFill && bleedAvoidance == BackgroundBleedUseTransparencyLayer);
728760 GraphicsContextStateSaver clipToBorderStateSaver(*context, clipToBorderRadius);
729761 if (clipToBorderRadius) {
730  RoundedRect border = getBackgroundRoundedRect(backgroundRectAdjustedForBleedAvoidance(context, rect, bleedAvoidance), box, boxSize.width(), boxSize.height(), includeLeftEdge, includeRightEdge);
731  context->addRoundedRectClip(border);
 762 LayoutRect adjustedRect = isBorderFill ? backgroundRectAdjustedForBleedAvoidance(context, rect, bleedAvoidance) : rect;
 763 RoundedRect border = getBackgroundRoundedRect(adjustedRect, box, boxSize.width(), boxSize.height(), includeLeftEdge, includeRightEdge);
 764
 765 // Clip to the padding or content boxes as necessary.
 766 if (bgLayer->clip() == ContentFillBox) {
 767 border = style()->getRoundedInnerBorderFor(border.rect(),
 768 paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), includeLeftEdge, includeRightEdge);
 769 } else if (bgLayer->clip() == PaddingFillBox)
 770 border = style()->getRoundedInnerBorderFor(border.rect(), includeLeftEdge, includeRightEdge);
 771
 772 clipRoundedInnerRect(context, rect, border);
732773 }
733774
734775 LayoutUnit bLeft = includeLeftEdge ? borderLeft() : zeroLayoutUnit;

@@void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
756797
757798 if (bgLayer->clip() == PaddingFillBox || bgLayer->clip() == ContentFillBox) {
758799 // Clip to the padding or content boxes as necessary.
759  bool includePadding = bgLayer->clip() == ContentFillBox;
760  LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : zeroLayoutUnit),
761  scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : zeroLayoutUnit),
762  scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : zeroLayoutUnit),
763  scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : zeroLayoutUnit));
764  backgroundClipStateSaver.save();
765  context->clip(clipRect);
 800 if (!clipToBorderRadius) {
 801 bool includePadding = bgLayer->clip() == ContentFillBox;
 802 LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : zeroLayoutUnit),
 803 scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : zeroLayoutUnit),
 804 scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : zeroLayoutUnit),
 805 scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : zeroLayoutUnit));
 806 backgroundClipStateSaver.save();
 807 context->clip(clipRect);
 808 }
766809 } else if (bgLayer->clip() == TextFillBox) {
767810 // We have to draw our text into a mask that can then be used to clip background drawing.
768811 // First figure out how big the mask has to be. It should be no bigger than what we need

Source/WebCore/rendering/RenderBoxModelObject.h

@@private:
222222 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
223223 bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
224224
 225 void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const RoundedRect& clipRect);
 226
225227 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
226228 BoxSide, bool firstEdgeMatches, bool secondEdgeMatches);
227229 void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&, const RoundedRect&, BoxSide, const class BorderEdge[]);