OLD | NEW |
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 LayoutBoxModelObject::LayoutBoxModelObject(ContainerNode* node) | 106 LayoutBoxModelObject::LayoutBoxModelObject(ContainerNode* node) |
107 : LayoutObject(node) {} | 107 : LayoutObject(node) {} |
108 | 108 |
109 bool LayoutBoxModelObject::usesCompositedScrolling() const { | 109 bool LayoutBoxModelObject::usesCompositedScrolling() const { |
110 return hasOverflowClip() && hasLayer() && | 110 return hasOverflowClip() && hasLayer() && |
111 layer()->getScrollableArea()->usesCompositedScrolling(); | 111 layer()->getScrollableArea()->usesCompositedScrolling(); |
112 } | 112 } |
113 | 113 |
114 bool LayoutBoxModelObject::hasLocalEquivalentBackground() const { | 114 bool LayoutBoxModelObject::hasLocalEquivalentBackground() const { |
115 int minBorderWidth = std::min( | |
116 style()->borderTopWidth(), | |
117 std::min( | |
118 style()->borderLeftWidth(), | |
119 std::min(style()->borderRightWidth(), style()->borderBottomWidth()))); | |
120 bool outlineOverlapsPaddingBox = style()->outlineOffset() < -minBorderWidth; | |
121 bool hasCustomScrollbars = false; | 115 bool hasCustomScrollbars = false; |
122 // TODO(flackr): Detect opaque custom scrollbars which would cover up a | 116 // TODO(flackr): Detect opaque custom scrollbars which would cover up a |
123 // border-box background. | 117 // border-box background. |
124 if (PaintLayerScrollableArea* scrollableArea = getScrollableArea()) { | 118 if (PaintLayerScrollableArea* scrollableArea = getScrollableArea()) { |
125 if ((scrollableArea->horizontalScrollbar() && | 119 if ((scrollableArea->horizontalScrollbar() && |
126 scrollableArea->horizontalScrollbar()->isCustomScrollbar()) || | 120 scrollableArea->horizontalScrollbar()->isCustomScrollbar()) || |
127 (scrollableArea->verticalScrollbar() && | 121 (scrollableArea->verticalScrollbar() && |
128 scrollableArea->verticalScrollbar()->isCustomScrollbar())) { | 122 scrollableArea->verticalScrollbar()->isCustomScrollbar())) { |
129 hasCustomScrollbars = true; | 123 hasCustomScrollbars = true; |
130 } | 124 } |
131 } | 125 } |
132 | 126 |
133 // TODO(flackr): When we correctly clip the scrolling contents layer we can | 127 // TODO(flackr): When we correctly clip the scrolling contents layer we can |
134 // paint locally equivalent backgrounds into it. https://crbug.com/645957 | 128 // paint locally equivalent backgrounds into it. https://crbug.com/645957 |
135 if (!style()->hasAutoClip()) | 129 if (!style()->hasAutoClip()) |
136 return false; | 130 return false; |
137 | 131 |
138 // TODO(flackr): Remove this when box shadows are still painted correctly when | 132 // TODO(flackr): Remove this when box shadows are still painted correctly when |
139 // painting into the composited scrolling contents layer. | 133 // painting into the composited scrolling contents layer. |
140 // https://crbug.com/646464 | 134 // https://crbug.com/646464 |
141 if (style()->boxShadow()) | 135 if (style()->boxShadow()) |
142 return false; | 136 return false; |
143 | 137 |
144 const FillLayer* layer = &(style()->backgroundLayers()); | 138 const FillLayer* layer = &(style()->backgroundLayers()); |
145 for (; layer; layer = layer->next()) { | 139 for (; layer; layer = layer->next()) { |
146 if (layer->attachment() == LocalBackgroundAttachment) | 140 if (layer->attachment() == LocalBackgroundAttachment) |
147 continue; | 141 continue; |
148 | 142 |
149 // If the outline draws inside the border, it intends to draw on top of the | |
150 // scroller's background, however because it is painted into a layer behind | |
151 // the scrolling contents layer we avoid auto promoting in this case to | |
152 // avoid obscuring the outline. | |
153 // TODO(flackr): Outlines should be drawn on top of the scrolling contents | |
154 // layer so that they cannot be covered up by composited scrolling contents. | |
155 if (outlineOverlapsPaddingBox) | |
156 return false; | |
157 | |
158 // Solid color layers with an effective background clip of the padding box | 143 // Solid color layers with an effective background clip of the padding box |
159 // can be treated as local. | 144 // can be treated as local. |
160 if (!layer->image() && !layer->next() && | 145 if (!layer->image() && !layer->next() && |
161 resolveColor(CSSPropertyBackgroundColor).alpha() > 0) { | 146 resolveColor(CSSPropertyBackgroundColor).alpha() > 0) { |
162 EFillBox clip = layer->clip(); | 147 EFillBox clip = layer->clip(); |
163 if (clip == PaddingFillBox) | 148 if (clip == PaddingFillBox) |
164 continue; | 149 continue; |
165 // A border box can be treated as a padding box if the border is opaque or | 150 // A border box can be treated as a padding box if the border is opaque or |
166 // there is no border and we don't have custom scrollbars. | 151 // there is no border and we don't have custom scrollbars. |
167 if (clip == BorderFillBox && !hasCustomScrollbars && | 152 if (clip == BorderFillBox && !hasCustomScrollbars && |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 if (rootElementStyle->hasBackground()) | 1314 if (rootElementStyle->hasBackground()) |
1330 return false; | 1315 return false; |
1331 | 1316 |
1332 if (node() != document().firstBodyElement()) | 1317 if (node() != document().firstBodyElement()) |
1333 return false; | 1318 return false; |
1334 | 1319 |
1335 return true; | 1320 return true; |
1336 } | 1321 } |
1337 | 1322 |
1338 } // namespace blink | 1323 } // namespace blink |
OLD | NEW |