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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp

Issue 2464053003: Always paint background and shadow separately (Closed)
Patch Set: Rebaseline-cl (invisible pixel changes along shadow edges) (The original Patch Set 2 was removed to get the try result in Patch Set 1) Created 4 years, 1 month 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 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 } 1074 }
1075 1075
1076 LayoutUnit LayoutBoxModelObject::computedCSSPadding( 1076 LayoutUnit LayoutBoxModelObject::computedCSSPadding(
1077 const Length& padding) const { 1077 const Length& padding) const {
1078 LayoutUnit w; 1078 LayoutUnit w;
1079 if (padding.isPercentOrCalc()) 1079 if (padding.isPercentOrCalc())
1080 w = containingBlockLogicalWidthForContent(); 1080 w = containingBlockLogicalWidthForContent();
1081 return minimumValueForLength(padding, w); 1081 return minimumValueForLength(padding, w);
1082 } 1082 }
1083 1083
1084 bool LayoutBoxModelObject::boxShadowShouldBeAppliedToBackground(
1085 BackgroundBleedAvoidance bleedAvoidance,
1086 const InlineFlowBox* inlineFlowBox) const {
1087 if (bleedAvoidance != BackgroundBleedNone)
1088 return false;
1089
1090 if (style()->hasAppearance())
1091 return false;
1092
1093 const ShadowList* shadowList = style()->boxShadow();
1094 if (!shadowList)
1095 return false;
1096
1097 bool hasOneNormalBoxShadow = false;
1098 size_t shadowCount = shadowList->shadows().size();
1099 for (size_t i = 0; i < shadowCount; ++i) {
1100 const ShadowData& currentShadow = shadowList->shadows()[i];
1101 if (currentShadow.style() != Normal)
1102 continue;
1103
1104 if (hasOneNormalBoxShadow)
1105 return false;
1106 hasOneNormalBoxShadow = true;
1107
1108 if (currentShadow.spread())
1109 return false;
1110 }
1111
1112 if (!hasOneNormalBoxShadow)
1113 return false;
1114
1115 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor);
1116 if (backgroundColor.hasAlpha())
1117 return false;
1118
1119 const FillLayer* lastBackgroundLayer = &style()->backgroundLayers();
1120 for (const FillLayer* next = lastBackgroundLayer->next(); next;
1121 next = lastBackgroundLayer->next())
1122 lastBackgroundLayer = next;
1123
1124 if (lastBackgroundLayer->clip() != BorderFillBox)
1125 return false;
1126
1127 if (lastBackgroundLayer->image() && style()->hasBorderRadius())
1128 return false;
1129
1130 if (inlineFlowBox &&
1131 !inlineFlowBox->boxShadowCanBeAppliedToBackground(*lastBackgroundLayer))
1132 return false;
1133
1134 if (hasOverflowClip() &&
1135 lastBackgroundLayer->attachment() == LocalBackgroundAttachment)
1136 return false;
1137
1138 return true;
1139 }
1140
1141 LayoutUnit LayoutBoxModelObject::containingBlockLogicalWidthForContent() const { 1084 LayoutUnit LayoutBoxModelObject::containingBlockLogicalWidthForContent() const {
1142 return containingBlock()->availableLogicalWidth(); 1085 return containingBlock()->availableLogicalWidth();
1143 } 1086 }
1144 1087
1145 LayoutBoxModelObject* LayoutBoxModelObject::continuation() const { 1088 LayoutBoxModelObject* LayoutBoxModelObject::continuation() const {
1146 return (!continuationMap) ? nullptr : continuationMap->get(this); 1089 return (!continuationMap) ? nullptr : continuationMap->get(this);
1147 } 1090 }
1148 1091
1149 void LayoutBoxModelObject::setContinuation(LayoutBoxModelObject* continuation) { 1092 void LayoutBoxModelObject::setContinuation(LayoutBoxModelObject* continuation) {
1150 if (continuation) { 1093 if (continuation) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 if (rootElementStyle->hasBackground()) 1336 if (rootElementStyle->hasBackground())
1394 return false; 1337 return false;
1395 1338
1396 if (node() != document().firstBodyElement()) 1339 if (node() != document().firstBodyElement())
1397 return false; 1340 return false;
1398 1341
1399 return true; 1342 return true;
1400 } 1343 }
1401 1344
1402 } // namespace blink 1345 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698