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/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
9 #include "core/style/BorderEdge.h" | 9 #include "core/style/BorderEdge.h" |
10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 if (!hasBackground) | 48 if (!hasBackground) |
49 return BackgroundBleedNone; | 49 return BackgroundBleedNone; |
50 | 50 |
51 const ComputedStyle& boxStyle = layoutBox.styleRef(); | 51 const ComputedStyle& boxStyle = layoutBox.styleRef(); |
52 const bool hasBorderRadius = boxStyle.hasBorderRadius(); | 52 const bool hasBorderRadius = boxStyle.hasBorderRadius(); |
53 if (!hasBorderDecoration || !hasBorderRadius || | 53 if (!hasBorderDecoration || !hasBorderRadius || |
54 layoutBox.canRenderBorderImage()) { | 54 layoutBox.canRenderBorderImage()) { |
55 if (layoutBox.backgroundShouldAlwaysBeClipped()) | 55 if (layoutBox.backgroundShouldAlwaysBeClipped()) |
56 return BackgroundBleedClipOnly; | 56 return BackgroundBleedClipOnly; |
57 // Border radius clipping may require layer bleed avoidance if we are going
to draw | 57 // Border radius clipping may require layer bleed avoidance if we are going |
58 // an image over something else, because we do not want the antialiasing to
lead to bleeding | 58 // to draw an image over something else, because we do not want the |
| 59 // antialiasing to lead to bleeding |
59 if (boxStyle.hasBackgroundImage() && hasBorderRadius) { | 60 if (boxStyle.hasBackgroundImage() && hasBorderRadius) { |
60 // But if the top layer is opaque for the purposes of background painting,
we do not | 61 // But if the top layer is opaque for the purposes of background painting, |
61 // need the bleed avoidance because we will not paint anything behind the
top layer. | 62 // we do not need the bleed avoidance because we will not paint anything |
62 // But only if we need to draw something underneath. | 63 // behind the top layer. But only if we need to draw something |
| 64 // underneath. |
63 const FillLayer& fillLayer = layoutBox.style()->backgroundLayers(); | 65 const FillLayer& fillLayer = layoutBox.style()->backgroundLayers(); |
64 if ((backgroundColor.alpha() || fillLayer.next()) && | 66 if ((backgroundColor.alpha() || fillLayer.next()) && |
65 !fillLayer.imageOccludesNextLayers(layoutBox)) | 67 !fillLayer.imageOccludesNextLayers(layoutBox)) |
66 return BackgroundBleedClipLayer; | 68 return BackgroundBleedClipLayer; |
67 } | 69 } |
68 return BackgroundBleedNone; | 70 return BackgroundBleedNone; |
69 } | 71 } |
70 | 72 |
71 if (borderObscuresBackgroundEdge(boxStyle)) | 73 if (borderObscuresBackgroundEdge(boxStyle)) |
72 return BackgroundBleedShrinkBackground; | 74 return BackgroundBleedShrinkBackground; |
73 | 75 |
74 return BackgroundBleedClipLayer; | 76 return BackgroundBleedClipLayer; |
75 } | 77 } |
76 | 78 |
77 } // namespace blink | 79 } // namespace blink |
OLD | NEW |