<rdar://problem/9335973> REGRESSION (r84341): Buttons in the Mac App store are render...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Apr 2011 18:29:06 +0000 (18:29 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Apr 2011 18:29:06 +0000 (18:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=59622

Reviewed by Anders Carlsson.

Source/WebCore:

Test: fast/borders/border-image-trumps-radius.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::determineBackgroundBleedAvoidance): If there is a renderable, loaded border
image, then border radius is ignored, so no bleed avoidance is needed.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::borderImageIsLoadedAndCanBeRendered): Added. Moved some logic here from...
(WebCore::RenderObject::mustRepaintBackgroundOrBorder): ...here.
* rendering/RenderObject.h:

LayoutTests:

* fast/borders/border-image-trumps-radius-expected.png: Added.
* fast/borders/border-image-trumps-radius-expected.txt: Added.
* fast/borders/border-image-trumps-radius.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85067 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/borders/border-image-trumps-radius-expected.png [new file with mode: 0644]
LayoutTests/fast/borders/border-image-trumps-radius-expected.txt [new file with mode: 0644]
LayoutTests/fast/borders/border-image-trumps-radius.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h

index ce149b11ad9ae02c8b34c1631c648e7faf31945a..c27c765f1f6cd1610aed769986c05e0410de45d7 100644 (file)
@@ -1,3 +1,14 @@
+2011-04-27  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        <rdar://problem/9335973> REGRESSION (r84341): Buttons in the Mac App store are rendered incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=59622
+
+        * fast/borders/border-image-trumps-radius-expected.png: Added.
+        * fast/borders/border-image-trumps-radius-expected.txt: Added.
+        * fast/borders/border-image-trumps-radius.html: Added.
+
 2011-04-27  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/borders/border-image-trumps-radius-expected.png b/LayoutTests/fast/borders/border-image-trumps-radius-expected.png
new file mode 100644 (file)
index 0000000..6835cd5
Binary files /dev/null and b/LayoutTests/fast/borders/border-image-trumps-radius-expected.png differ
diff --git a/LayoutTests/fast/borders/border-image-trumps-radius-expected.txt b/LayoutTests/fast/borders/border-image-trumps-radius-expected.txt
new file mode 100644 (file)
index 0000000..0495510
--- /dev/null
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#FF0000]
+      RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#FF0000] [border: (10px none #0000FF7F)]
diff --git a/LayoutTests/fast/borders/border-image-trumps-radius.html b/LayoutTests/fast/borders/border-image-trumps-radius.html
new file mode 100644 (file)
index 0000000..d0b2cfd
--- /dev/null
@@ -0,0 +1,11 @@
+<div style="width: 100px; height: 100px; background-color: red;"></div>
+<div style="
+    margin-top: -100px;
+    background-color: red;
+    border-radius: 50px;
+    width: 80px;
+    height: 80px;
+    border-width: 10px;
+    border-color: rgba(0, 0, 255, 0.5);
+    -webkit-border-image: -webkit-linear-gradient(green, green) 10 10 10 10;
+"></div>
index 7e5bf72076fc07e4e6541aa83dbebf68ea726a0d..ace754f76e0e59a0c5479e9da925cb8749ce1a0c 100644 (file)
@@ -1,3 +1,20 @@
+2011-04-27  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        <rdar://problem/9335973> REGRESSION (r84341): Buttons in the Mac App store are rendered incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=59622
+
+        Test: fast/borders/border-image-trumps-radius.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::determineBackgroundBleedAvoidance): If there is a renderable, loaded border
+        image, then border radius is ignored, so no bleed avoidance is needed.
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::borderImageIsLoadedAndCanBeRendered): Added. Moved some logic here from...
+        (WebCore::RenderObject::mustRepaintBackgroundOrBorder): ...here.
+        * rendering/RenderObject.h:
+
 2011-02-03  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Xan Lopez.
index af33090aaf133ec0548b71255502ec7dfb45ce24..130d0c1d6dd3c1a59a0d0ad9e7ecaea6b84ec45c 100644 (file)
@@ -820,7 +820,7 @@ BackgroundBleedAvoidance RenderBox::determineBackgroundBleedAvoidance(GraphicsCo
 
     const RenderStyle* style = this->style();
 
-    if (!style->hasBackground() || !style->hasBorder() || !style->hasBorderRadius())
+    if (!style->hasBackground() || !style->hasBorder() || !style->hasBorderRadius() || borderImageIsLoadedAndCanBeRendered())
         return BackgroundBleedNone;
 
     AffineTransform ctm = context->getCTM();
index 860a9bb9662436ecf308148fe90488e467dccb51..56ea3d4fff0444d0a36297c81ddc7709d92efb29 100644 (file)
@@ -677,6 +677,14 @@ static bool mustRepaintFillLayers(const RenderObject* renderer, const FillLayer*
     return false;
 }
 
+bool RenderObject::borderImageIsLoadedAndCanBeRendered() const
+{
+    ASSERT(style()->hasBorder());
+
+    StyleImage* borderImage = style()->borderImage().image();
+    return borderImage && borderImage->canRender(style()->effectiveZoom()) && borderImage->isLoaded();
+}
+
 bool RenderObject::mustRepaintBackgroundOrBorder() const
 {
     if (hasMask() && mustRepaintFillLayers(this, style()->maskLayers()))
@@ -690,15 +698,8 @@ bool RenderObject::mustRepaintBackgroundOrBorder() const
         return true;
      
     // Our fill layers are ok.  Let's check border.
-    if (style()->hasBorder()) {
-        // Border images are not ok.
-        StyleImage* borderImage = style()->borderImage().image();
-        bool shouldPaintBorderImage = borderImage && borderImage->canRender(style()->effectiveZoom());
-
-        // If the image hasn't loaded, we're still using the normal border style.
-        if (shouldPaintBorderImage && borderImage->isLoaded())
-            return true;
-    }
+    if (style()->hasBorder() && borderImageIsLoadedAndCanBeRendered())
+        return true;
 
     return false;
 }
index 75cc8a8a7c10ad17f87d5f3ab602401aba98f723..1f36a18efa75bce11201289d2fd340a4556f4e91 100644 (file)
@@ -416,6 +416,7 @@ public:
     bool hasLayer() const { return m_hasLayer; }
     
     bool hasBoxDecorations() const { return m_paintBackground; }
+    bool borderImageIsLoadedAndCanBeRendered() const;
     bool mustRepaintBackgroundOrBorder() const;
     bool hasBackground() const { return style()->hasBackground(); }
     bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout || m_needsSimplifiedNormalFlowLayout || m_needsPositionedMovementLayout; }