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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 { 1261 {
1262 return allLayersAreFixed(backgroundLayers()); 1262 return allLayersAreFixed(backgroundLayers());
1263 } 1263 }
1264 1264
1265 bool ComputedStyle::hasEntirelyLocalBackground() const 1265 bool ComputedStyle::hasEntirelyLocalBackground() const
1266 { 1266 {
1267 const FillLayer* layer = &backgroundLayers(); 1267 const FillLayer* layer = &backgroundLayers();
1268 for (; layer; layer = layer->next()) { 1268 for (; layer; layer = layer->next()) {
1269 if (layer->attachment() == LocalBackgroundAttachment) 1269 if (layer->attachment() == LocalBackgroundAttachment)
1270 continue; 1270 continue;
1271 // Solid color layers with a background clip of the padding box can be t reated 1271 // Solid color layers with an effective background clip of the padding b ox can be treated
1272 // as local. 1272 // as local.
1273 // TODO(flackr): We can handle other fill boxes with solid colors as lon g as they 1273 if (!layer->image() && !layer->next()) {
1274 // are essentially the same (i.e. PaddingFillBox == ContentFillBox when padding = 0). 1274 EFillBox clip = layer->clip();
1275 if (!layer->image() && !layer->next() && layer->clip() == PaddingFillBox ) 1275 if (clip == PaddingFillBox)
1276 continue; 1276 continue;
1277 // A border box can be treated as a padding box if the border is opa que or there is
1278 // no border.
1279 if (clip == BorderFillBox
1280 && (borderTopWidth() == 0 || !visitedDependentColor(CSSPropertyB orderTopColor).hasAlpha())
1281 && (borderLeftWidth() == 0 || !visitedDependentColor(CSSProperty BorderLeftColor).hasAlpha())
1282 && (borderRightWidth() == 0 || !visitedDependentColor(CSSPropert yBorderRightColor).hasAlpha())
1283 && (borderBottomWidth() == 0 || !visitedDependentColor(CSSProper tyBorderBottomColor).hasAlpha())) {
1284 continue;
1285 }
1286 // A content fill box can be treated as a padding fill box if there is no padding.
1287 if (clip == ContentFillBox
1288 && paddingTop().isZero()
1289 && paddingLeft().isZero()
1290 && paddingRight().isZero()
1291 && paddingBottom().isZero()) {
1292 continue;
1293 }
1294 }
1277 return false; 1295 return false;
1278 } 1296 }
1279 return true; 1297 return true;
1280 } 1298 }
1281 1299
1282 const CounterDirectiveMap* ComputedStyle::counterDirectives() const 1300 const CounterDirectiveMap* ComputedStyle::counterDirectives() const
1283 { 1301 {
1284 return m_rareNonInheritedData->m_counterDirectives.get(); 1302 return m_rareNonInheritedData->m_counterDirectives.get();
1285 } 1303 }
1286 1304
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 if (value < 0) 2057 if (value < 0)
2040 fvalue -= 0.5f; 2058 fvalue -= 0.5f;
2041 else 2059 else
2042 fvalue += 0.5f; 2060 fvalue += 0.5f;
2043 } 2061 }
2044 2062
2045 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2063 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2046 } 2064 }
2047 2065
2048 } // namespace blink 2066 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698