Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1118)

Unified Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 23483051: Blend background with existing content (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix test in android Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/Settings.in ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBoxModelObject.cpp
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index e39ec2174ffdffc6194e4a1749fcd36f5fda846a..36ac404b6f292148164fb1b087098e5770477bba 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -702,29 +702,28 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
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, this);
- if (baseColor.alpha()) {
- if (bgColor.alpha())
- baseColor = baseColor.blend(bgColor);
-
- context->fillRect(backgroundRect, baseColor, CompositeCopy);
+ if (isOpaqueRoot) {
+ // If we have an alpha and we are painting the root element, go ahead and blend with the base background color.
+ Color baseColor = view()->frameView()->baseBackgroundColor();
+ bool shouldClearDocumentBackground = document().settings() && document().settings()->shouldClearDocumentBackground();
+ CompositeOperator operation = shouldClearDocumentBackground ? CompositeCopy : context->compositeOperation();
+
+ if (baseColor.alpha()) {
+ if (bgColor.alpha())
+ baseColor = baseColor.blend(bgColor);
+ context->fillRect(backgroundRect, baseColor, operation);
+ } else if (bgColor.alpha()) {
+ context->fillRect(backgroundRect, bgColor, operation);
+ } else if (shouldClearDocumentBackground) {
+ context->clearRect(backgroundRect);
+ }
} else if (bgColor.alpha()) {
- CompositeOperator operation = shouldClearBackground ? CompositeCopy : context->compositeOperation();
- context->fillRect(backgroundRect, bgColor, operation);
- } else if (shouldClearBackground)
- context->clearRect(backgroundRect);
+ context->fillRect(backgroundRect, bgColor, context->compositeOperation());
+ }
}
}
« no previous file with comments | « Source/core/page/Settings.in ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698