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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2264663002: Paint solid color backgrounds which are equivalent to locally attached into scrolling contents layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scrollcontent-paint-bg
Patch Set: Add tests for padding-box equivalent backgrounds. Created 4 years, 4 months 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
Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 227d0f12e1d8f04b964c54243687efaddc5c82c5..a8621108df516216ef516f5ee7d0c46c66080ae3 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1268,12 +1268,30 @@ bool ComputedStyle::hasEntirelyLocalBackground() const
for (; layer; layer = layer->next()) {
if (layer->attachment() == LocalBackgroundAttachment)
continue;
- // Solid color layers with a background clip of the padding box can be treated
+ // Solid color layers with an effective background clip of the padding box can be treated
// as local.
- // TODO(flackr): We can handle other fill boxes with solid colors as long as they
- // are essentially the same (i.e. PaddingFillBox == ContentFillBox when padding = 0).
- if (!layer->image() && !layer->next() && layer->clip() == PaddingFillBox)
- continue;
+ if (!layer->image() && !layer->next()) {
+ EFillBox clip = layer->clip();
+ if (clip == PaddingFillBox)
+ continue;
+ // A border box can be treated as a padding box if the border is opaque or there is
+ // no border.
+ if (clip == BorderFillBox
+ && (borderTopWidth() == 0 || !visitedDependentColor(CSSPropertyBorderTopColor).hasAlpha())
+ && (borderLeftWidth() == 0 || !visitedDependentColor(CSSPropertyBorderLeftColor).hasAlpha())
+ && (borderRightWidth() == 0 || !visitedDependentColor(CSSPropertyBorderRightColor).hasAlpha())
+ && (borderBottomWidth() == 0 || !visitedDependentColor(CSSPropertyBorderBottomColor).hasAlpha())) {
+ continue;
+ }
+ // A content fill box can be treated as a padding fill box if there is no padding.
+ if (clip == ContentFillBox
+ && paddingTop().isZero()
+ && paddingLeft().isZero()
+ && paddingRight().isZero()
+ && paddingBottom().isZero()) {
+ continue;
+ }
+ }
return false;
}
return true;

Powered by Google App Engine
This is Rietveld 408576698