summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjunov <junov@google.com>2013-02-22 12:16:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-28 15:16:22 +0100
commit5ed26913a30b9484ef4b2394dd8f08e7509161ac (patch)
tree59e516a959c3aa7396f473055c04ab79e0d0150b
parent836b2f659d55b8197970adeeb0515a5a37293e84 (diff)
downloadqtwebkit-5ed26913a30b9484ef4b2394dd8f08e7509161ac.tar.gz
REGRESSION (r135628-135632): Double box shadow failure to render
https://bugs.webkit.org/show_bug.cgi?id=107833 Reviewed by Simon Fraser. Source/WebCore: Regression caused by http://trac.webkit.org/changeset/135629 The regression was due to faulty occlusion logic that was assuming that drawing the background color of a render box background layer could be skipped when the same layer also has an opaque image attached. In the case where the background color is drawn for the purpose of rendering a box shadow, the shadow is typically not completely occluded by the background image because of the shadow blur and/or offset. This patch fixes the problem by not culling a background draw if it is used to draw a box shadow. Test: fast/backgrounds/gradient-background-shadow.html * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): Changing occlusion culling test to never cull background color draw if it is used to draw a box shadow. This is because box shadows can draw outside the border fill region. LayoutTests: New ref test verifies that box shadow is drawn when background is an opaque image. Test uses an blue gradient as background image. Reference uses blue background color. * fast/backgrounds/gradient-background-shadow-expected.html: Added. * fast/backgrounds/gradient-background-shadow.html: Added. Change-Id: I81e3271f1fdc312fd54dcd9de81903b12b1a9903 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141160 268f45cc-cd09-0410-ab3c-d52691b4dbfc Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--Source/WebCore/ChangeLog25
-rw-r--r--Source/WebCore/rendering/RenderBoxModelObject.cpp50
2 files changed, 51 insertions, 24 deletions
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 8ee46f4b5..3f112badb 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -24,6 +24,31 @@
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::clipBounds):
+2013-01-29 Justin Novosad <junov@google.com>
+
+ REGRESSION (r135628-135632): Double box shadow failure to render
+ https://bugs.webkit.org/show_bug.cgi?id=107833
+
+ Reviewed by Simon Fraser.
+
+ Regression caused by http://trac.webkit.org/changeset/135629
+ The regression was due to faulty occlusion logic that was assuming
+ that drawing the background color of a render box background layer
+ could be skipped when the same layer also has an opaque image attached.
+ In the case where the background color is drawn for the purpose of
+ rendering a box shadow, the shadow is typically not
+ completely occluded by the background image because of the shadow
+ blur and/or offset. This patch fixes the problem by not culling a
+ background draw if it is used to draw a box shadow.
+
+ Test: fast/backgrounds/gradient-background-shadow.html
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+ Changing occlusion culling test to never cull background color
+ draw if it is used to draw a box shadow. This is because box shadows
+ can draw outside the border fill region.
+
2013-01-29 Allan Sandfeld Jensen <allan.jensen@digia.com>
REGRESSION: ChildrenAffectedBy flags lost between siblings which have child elements sharing style
diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp
index cd1822f3e..6d63169b5 100644
--- a/Source/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp
@@ -910,35 +910,37 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
// Paint the color first underneath all images, culled if background image occludes it.
// FIXME: In the bgLayer->hasFiniteBounds() case, we could improve the culling test
// by verifying whether the background image covers the entire layout rect.
- if (!bgLayer->next() && !(shouldPaintBackgroundImage && bgLayer->hasOpaqueImage(this) && bgLayer->hasRepeatXY())) {
+ if (!bgLayer->next()) {
IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect));
bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppliedToBackground(bleedAvoidance, box);
- if (!boxShadowShouldBeAppliedToBackground)
- backgroundRect.intersect(paintInfo.rect);
-
- // If we have an alpha and we are painting the root element, go ahead and blend with the base background color.
- Color baseColor;
- bool shouldClearBackground = false;
- if (isOpaqueRoot) {
- baseColor = view()->frameView()->baseBackgroundColor();
- if (!baseColor.alpha())
- shouldClearBackground = true;
- }
+ if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage || !bgLayer->hasOpaqueImage(this) || !bgLayer->hasRepeatXY()) {
+ if (!boxShadowShouldBeAppliedToBackground)
+ backgroundRect.intersect(paintInfo.rect);
+
+ // If we have an alpha and we are painting the root element, go ahead and blend with the base background color.
+ Color baseColor;
+ bool shouldClearBackground = false;
+ if (isOpaqueRoot) {
+ baseColor = view()->frameView()->baseBackgroundColor();
+ if (!baseColor.alpha())
+ shouldClearBackground = true;
+ }
- GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAppliedToBackground);
- if (boxShadowShouldBeAppliedToBackground)
- applyBoxShadowForBackground(context, style());
+ GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAppliedToBackground);
+ if (boxShadowShouldBeAppliedToBackground)
+ applyBoxShadowForBackground(context, style());
- if (baseColor.alpha()) {
- if (bgColor.alpha())
- baseColor = baseColor.blend(bgColor);
+ if (baseColor.alpha()) {
+ if (bgColor.alpha())
+ baseColor = baseColor.blend(bgColor);
- context->fillRect(backgroundRect, baseColor, style()->colorSpace(), CompositeCopy);
- } else if (bgColor.alpha()) {
- CompositeOperator operation = shouldClearBackground ? CompositeCopy : context->compositeOperation();
- context->fillRect(backgroundRect, bgColor, style()->colorSpace(), operation);
- } else if (shouldClearBackground)
- context->clearRect(backgroundRect);
+ context->fillRect(backgroundRect, baseColor, style()->colorSpace(), CompositeCopy);
+ } else if (bgColor.alpha()) {
+ CompositeOperator operation = shouldClearBackground ? CompositeCopy : context->compositeOperation();
+ context->fillRect(backgroundRect, bgColor, style()->colorSpace(), operation);
+ } else if (shouldClearBackground)
+ context->clearRect(backgroundRect);
+ }
}
// no progressive loading of the background image