Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/BoxDecorationData.h" | 5 #include "core/paint/BoxDecorationData.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBox.h" | 7 #include "core/layout/LayoutBox.h" |
| 8 #include "core/style/BorderEdge.h" | 8 #include "core/style/BorderEdge.h" |
| 9 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
| 10 #include "platform/RuntimeEnabledFeatures.h" | 10 #include "platform/RuntimeEnabledFeatures.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 } // anonymous namespace | 40 } // anonymous namespace |
| 41 | 41 |
| 42 BackgroundBleedAvoidance BoxDecorationData::determineBackgroundBleedAvoidance(co nst LayoutBox& layoutBox) | 42 BackgroundBleedAvoidance BoxDecorationData::determineBackgroundBleedAvoidance(co nst LayoutBox& layoutBox) |
| 43 { | 43 { |
| 44 if (layoutBox.isDocumentElement()) | 44 if (layoutBox.isDocumentElement()) |
| 45 return BackgroundBleedNone; | 45 return BackgroundBleedNone; |
| 46 | 46 |
| 47 if (!hasBackground) | 47 if (!hasBackground) |
| 48 return BackgroundBleedNone; | 48 return BackgroundBleedNone; |
| 49 | 49 |
| 50 if (!hasBorderDecoration || !layoutBox.style()->hasBorderRadius() || layoutB ox.canRenderBorderImage()) { | 50 const ComputedStyle& boxStyle = *layoutBox.style(); |
|
jbroman
2016/02/09 22:06:21
nit: *layoutBox.style() equivalent to layoutBox.st
| |
| 51 const bool hasBorderRadius = boxStyle.hasBorderRadius(); | |
| 52 if (!hasBorderDecoration || !hasBorderRadius || layoutBox.canRenderBorderIma ge()) { | |
| 51 if (layoutBox.backgroundShouldAlwaysBeClipped()) | 53 if (layoutBox.backgroundShouldAlwaysBeClipped()) |
| 52 return BackgroundBleedClipOnly; | 54 return BackgroundBleedClipOnly; |
| 55 if (backgroundColor.alpha() && boxStyle.hasBackgroundImage() && hasBorde rRadius) { | |
|
f(malita)
2016/02/09 22:07:39
I think one can stack background layers arbitraril
| |
| 56 // Prevent bleeding of background color behind the background image when we clip for the border radius | |
| 57 return BackgroundBleedClipLayer; | |
| 58 } | |
| 53 return BackgroundBleedNone; | 59 return BackgroundBleedNone; |
| 54 } | 60 } |
| 55 | 61 |
| 56 if (borderObscuresBackgroundEdge(*layoutBox.style())) | 62 if (borderObscuresBackgroundEdge(boxStyle)) |
| 57 return BackgroundBleedShrinkBackground; | 63 return BackgroundBleedShrinkBackground; |
| 58 | 64 |
| 59 return BackgroundBleedClipLayer; | 65 return BackgroundBleedClipLayer; |
| 60 } | 66 } |
| 61 | 67 |
| 62 } // namespace blink | 68 } // namespace blink |
| OLD | NEW |