Title: [137473] trunk
Revision
137473
Author
ju...@google.com
Date
2012-12-12 09:11:37 -0800 (Wed, 12 Dec 2012)

Log Message

Use render box background over border draw strategy in cases with background-image
https://bugs.webkit.org/show_bug.cgi?id=103409

Reviewed by Simon Fraser.

Source/WebCore:

The BackgroundOverBorderBleedAvoidance mode was not being used in
cases where the background is an opaque image. It was also not
being used in cases with multiple layers. The multiple layer
case is now safe with respect to color bleeding if the top layer
is opaque, thank to the recent addition of layer occlusion culling
in r135629.

No new tests. Testing already covered by the following tests:
fast/backgrounds/background-opaque-images-over-color.html
fast/backgrounds/gradient-background-leakage-2.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::determineBackgroundBleedAvoidance):
(WebCore::RenderBox::backgroundHasOpaqueTopLayer):
* rendering/RenderBox.h:
(RenderBox):

LayoutTests:

Added image failure expectation for
fast/backgrounds/gradient-background-leakage-2.html which needs
new baselines.

* platform/chromium/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (137472 => 137473)


--- trunk/LayoutTests/ChangeLog	2012-12-12 16:52:35 UTC (rev 137472)
+++ trunk/LayoutTests/ChangeLog	2012-12-12 17:11:37 UTC (rev 137473)
@@ -1,3 +1,16 @@
+2012-12-12  Justin Novosad  <ju...@google.com>
+
+        Use render box background over border draw strategy in cases with background-image
+        https://bugs.webkit.org/show_bug.cgi?id=103409
+
+        Reviewed by Simon Fraser.
+
+        Added image failure expectation for 
+        fast/backgrounds/gradient-background-leakage-2.html which needs
+        new baselines.
+
+        * platform/chromium/TestExpectations:
+
 2012-12-12  Philippe Normand  <pnorm...@igalia.com>
 
         Unreviewed, GTK gardening. Flag some flaky media tests after r137271.

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (137472 => 137473)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-12-12 16:52:35 UTC (rev 137472)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-12-12 17:11:37 UTC (rev 137473)
@@ -2142,6 +2142,9 @@
 
 crbug.com/43890 [ Win ] http/tests/loading/basic.html [ Failure Pass ]
 
+# Test need new image baselines with fix for webkit.org/b/103409
+webkit.org/b/103409 fast/backgrounds/gradient-background-leakage-2.html [ ImageOnlyFailure Pass ]
+
 # The following tests fail on all platforms and need further investigation.
 # Many of these are skipped on the Mac platform
 webkit.org/b/45991 canvas/philip/tests/2d.drawImage.broken.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (137472 => 137473)


--- trunk/Source/WebCore/ChangeLog	2012-12-12 16:52:35 UTC (rev 137472)
+++ trunk/Source/WebCore/ChangeLog	2012-12-12 17:11:37 UTC (rev 137473)
@@ -1,3 +1,27 @@
+2012-12-12  Justin Novosad  <ju...@google.com>
+
+        Use render box background over border draw strategy in cases with background-image
+        https://bugs.webkit.org/show_bug.cgi?id=103409
+
+        Reviewed by Simon Fraser.
+
+        The BackgroundOverBorderBleedAvoidance mode was not being used in
+        cases where the background is an opaque image. It was also not
+        being used in cases with multiple layers. The multiple layer
+        case is now safe with respect to color bleeding if the top layer
+        is opaque, thank to the recent addition of layer occlusion culling
+        in r135629.
+
+        No new tests. Testing already covered by the following tests:
+        fast/backgrounds/background-opaque-images-over-color.html
+        fast/backgrounds/gradient-background-leakage-2.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::determineBackgroundBleedAvoidance):
+        (WebCore::RenderBox::backgroundHasOpaqueTopLayer):
+        * rendering/RenderBox.h:
+        (RenderBox):
+
 2012-12-12  Ilya Tikhonovsky  <loi...@chromium.org>
 
         Web Inspector: instrument static parts of RenderBlock and RenderBox

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (137472 => 137473)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-12-12 16:52:35 UTC (rev 137472)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-12-12 17:11:37 UTC (rev 137473)
@@ -888,7 +888,7 @@
     FloatSize contextScaling(static_cast<float>(ctm.xScale()), static_cast<float>(ctm.yScale()));
     if (borderObscuresBackgroundEdge(contextScaling))
         return BackgroundBleedShrinkBackground;
-    if (!style->hasAppearance() && borderObscuresBackground() && backgroundIsSingleOpaqueLayer())
+    if (!style->hasAppearance() && borderObscuresBackground() && backgroundHasOpaqueTopLayer())
         return BackgroundBleedBackgroundOverBorder;
 
     return BackgroundBleedUseTransparencyLayer;
@@ -961,22 +961,26 @@
     }
 }
 
-bool RenderBox::backgroundIsSingleOpaqueLayer() const
+bool RenderBox::backgroundHasOpaqueTopLayer() const
 {
     const FillLayer* fillLayer = style()->backgroundLayers();
-    if (!fillLayer || fillLayer->next() || fillLayer->clip() != BorderFillBox || fillLayer->composite() != CompositeSourceOver)
+    if (!fillLayer || fillLayer->clip() != BorderFillBox)
         return false;
 
     // Clipped with local scrolling
     if (hasOverflowClip() && fillLayer->attachment() == LocalBackgroundAttachment)
         return false;
 
-    Color bgColor = style()->visitedDependentColor(CSSPropertyBackgroundColor);
-    if (bgColor.isValid() && bgColor.alpha() == 255)
+    if (fillLayer->hasOpaqueImage(this) && fillLayer->hasRepeatXY() && fillLayer->image()->canRender(this, style()->effectiveZoom()))
         return true;
-    
-    // FIXME: return true if a background image is present and is opaque
 
+    // If there is only one layer and no image, check whether the background color is opaque
+    if (!fillLayer->next() && !fillLayer->hasImage()) {
+        Color bgColor = style()->visitedDependentColor(CSSPropertyBackgroundColor);
+        if (bgColor.isValid() && bgColor.alpha() == 255)
+            return true;
+    }
+
     return false;
 }
 

Modified: trunk/Source/WebCore/rendering/RenderBox.h (137472 => 137473)


--- trunk/Source/WebCore/rendering/RenderBox.h	2012-12-12 16:52:35 UTC (rev 137472)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2012-12-12 17:11:37 UTC (rev 137473)
@@ -585,7 +585,7 @@
     void paintMaskImages(const PaintInfo&, const LayoutRect&);
 
     BackgroundBleedAvoidance determineBackgroundBleedAvoidance(GraphicsContext*) const;
-    bool backgroundIsSingleOpaqueLayer() const;
+    bool backgroundHasOpaqueTopLayer() const;
 
 #if PLATFORM(MAC)
     void paintCustomHighlight(const LayoutPoint&, const AtomicString& type, bool behindText);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to