Title: [121314] trunk
Revision
121314
Author
[email protected]
Date
2012-06-26 20:02:48 -0700 (Tue, 26 Jun 2012)

Log Message

REGRESSION(r107836): box shadow not drawn for opaque images with an opaque background
https://bugs.webkit.org/show_bug.cgi?id=89958

Patch by Douglas Stockwell <[email protected]> on 2012-06-26
Reviewed by Simon Fraser.

Source/WebCore:

Don't attempt to draw the box shadow as part of the background if the background is
obscured.

Test: fast/box-shadow/image-box-shadow.html

* rendering/RenderImage.cpp:
(WebCore::RenderImage::boxShadowShouldBeAppliedToBackground):
(WebCore):
* rendering/RenderImage.h:
(RenderImage):

LayoutTests:

* fast/box-shadow/image-box-shadow-expected.html: Added.
* fast/box-shadow/image-box-shadow.html: Added.
* fast/box-shadow/resources/green-alpha.png: Added.
* fast/box-shadow/resources/green.jpg: Added.
* fast/box-shadow/resources/green.png: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121313 => 121314)


--- trunk/LayoutTests/ChangeLog	2012-06-27 02:20:21 UTC (rev 121313)
+++ trunk/LayoutTests/ChangeLog	2012-06-27 03:02:48 UTC (rev 121314)
@@ -1,3 +1,16 @@
+2012-06-26  Douglas Stockwell  <[email protected]>
+
+        REGRESSION(r107836): box shadow not drawn for opaque images with an opaque background
+        https://bugs.webkit.org/show_bug.cgi?id=89958
+
+        Reviewed by Simon Fraser.
+
+        * fast/box-shadow/image-box-shadow-expected.html: Added.
+        * fast/box-shadow/image-box-shadow.html: Added.
+        * fast/box-shadow/resources/green-alpha.png: Added.
+        * fast/box-shadow/resources/green.jpg: Added.
+        * fast/box-shadow/resources/green.png: Added.
+
 2012-06-26  Kulanthaivel Palanichamy  <[email protected]>
 
         Unexpected element sizes when mixing inline-table with box-sizing

Added: trunk/LayoutTests/fast/box-shadow/image-box-shadow-expected.html (0 => 121314)


--- trunk/LayoutTests/fast/box-shadow/image-box-shadow-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/image-box-shadow-expected.html	2012-06-27 03:02:48 UTC (rev 121314)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<style>
+img {
+    width: 50px;
+    height: 25px;
+    margin-bottom: 25px;
+}
+div {
+    display: inline-block;
+    background: rgb(0,256,0);
+    height: 50px;
+}
+</style>
+<div><img src=""
+<div><img src=""
+<div><img src=""

Added: trunk/LayoutTests/fast/box-shadow/image-box-shadow.html (0 => 121314)


--- trunk/LayoutTests/fast/box-shadow/image-box-shadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/image-box-shadow.html	2012-06-27 03:02:48 UTC (rev 121314)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<style>
+img {
+    background: rgb(0,256,0);
+    width: 50px;
+    height: 25px;
+    margin-bottom: 25px;
+    box-shadow: 0px 25px rgb(0,256,0); 
+}
+div {
+    display: inline-block;
+    background: red;
+    height: 50px;
+}
+</style>
+<div><img src=""
+<div><img src=""
+<div><img src=""

Added: trunk/LayoutTests/fast/box-shadow/resources/green-alpha.png (0 => 121314)


--- trunk/LayoutTests/fast/box-shadow/resources/green-alpha.png	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/resources/green-alpha.png	2012-06-27 03:02:48 UTC (rev 121314)
@@ -0,0 +1,5 @@
+\x89PNG
+
+
+IHDRĉ
+IDAT[cd\xF8\xCFP\x86\x80\xA2"`IEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/fast/box-shadow/resources/green.jpg (0 => 121314)


--- trunk/LayoutTests/fast/box-shadow/resources/green.jpg	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/resources/green.jpg	2012-06-27 03:02:48 UTC (rev 121314)
@@ -0,0 +1,12 @@
+\xFF\xD8\xFF\xE0JFIF\xFF\xDBC	
+
+			
+
+		
+
+
+\xFF\xDBC	\xFF\xC0"\xFF\xC4	
+\xFF\xC4\xB5}!1AQa"q2\x81\x91\xA1#B\xB1\xC1R\xD1\xF0$3br\x82	
+%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\x83\x84\x85\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96\x97\x98\x99\x9A\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFF\xC4	
+\xFF\xC4\xB5w!1AQaq"2\x81B\x91\xA1\xB1\xC1	#3R\xF0br\xD1
+$4\xE1%\xF1&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96\x97\x98\x99\x9A\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFF\xDA?\xEE袊\xFE?\xCE#\xFF\xD9
\ No newline at end of file

Added: trunk/LayoutTests/fast/box-shadow/resources/green.png (0 => 121314)


--- trunk/LayoutTests/fast/box-shadow/resources/green.png	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/resources/green.png	2012-06-27 03:02:48 UTC (rev 121314)
@@ -0,0 +1,5 @@
+\x89PNG
+
+
+IHDRĉ
+IDAT[cd\xF8\xCF\xF0\xE5\xA8OIEND\xAEB`\x82
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (121313 => 121314)


--- trunk/Source/WebCore/ChangeLog	2012-06-27 02:20:21 UTC (rev 121313)
+++ trunk/Source/WebCore/ChangeLog	2012-06-27 03:02:48 UTC (rev 121314)
@@ -1,3 +1,21 @@
+2012-06-26  Douglas Stockwell  <[email protected]>
+
+        REGRESSION(r107836): box shadow not drawn for opaque images with an opaque background
+        https://bugs.webkit.org/show_bug.cgi?id=89958
+
+        Reviewed by Simon Fraser.
+
+        Don't attempt to draw the box shadow as part of the background if the background is
+        obscured.
+
+        Test: fast/box-shadow/image-box-shadow.html
+
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::boxShadowShouldBeAppliedToBackground):
+        (WebCore):
+        * rendering/RenderImage.h:
+        (RenderImage):
+
 2012-06-26  Nico Weber  <[email protected]>
 
         Fix new Wunused-private-field violations that crept in

Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (121313 => 121314)


--- trunk/Source/WebCore/rendering/RenderImage.cpp	2012-06-27 02:20:21 UTC (rev 121313)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp	2012-06-27 03:02:48 UTC (rev 121314)
@@ -453,6 +453,14 @@
     context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), style()->colorSpace(), alignedRect, compositeOperator, shouldRespectImageOrientation(), useLowQualityScaling);
 }
 
+bool RenderImage::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox*) const
+{
+    if (!RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(bleedAvoidance))
+        return false;
+
+    return !backgroundIsObscured();
+}
+
 bool RenderImage::backgroundIsObscured() const
 {
     if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())

Modified: trunk/Source/WebCore/rendering/RenderImage.h (121313 => 121314)


--- trunk/Source/WebCore/rendering/RenderImage.h	2012-06-27 02:20:21 UTC (rev 121313)
+++ trunk/Source/WebCore/rendering/RenderImage.h	2012-06-27 03:02:48 UTC (rev 121314)
@@ -91,6 +91,8 @@
     virtual void notifyFinished(CachedResource*);
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
 
+    virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const OVERRIDE;
+
     IntSize imageSizeForError(CachedImage*) const;
     void imageDimensionsChanged(bool imageSizeChanged, const IntRect* = 0);
     bool updateIntrinsicSizeIfNeeded(const IntSize&, bool imageSizeChanged);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to