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/paint/BoxPainter.h" | |
| 8 #include "core/style/BorderEdge.h" | 9 #include "core/style/BorderEdge.h" |
| 9 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
| 10 #include "platform/RuntimeEnabledFeatures.h" | 11 #include "platform/RuntimeEnabledFeatures.h" |
| 11 #include "platform/graphics/GraphicsContext.h" | 12 #include "platform/graphics/GraphicsContext.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 BoxDecorationData::BoxDecorationData(const LayoutBox& layoutBox) | 16 BoxDecorationData::BoxDecorationData(const LayoutBox& layoutBox) |
| 16 { | 17 { |
| 17 backgroundColor = layoutBox.style()->visitedDependentColor(CSSPropertyBackgr oundColor); | 18 backgroundColor = layoutBox.style()->visitedDependentColor(CSSPropertyBackgr oundColor); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 40 } // anonymous namespace | 41 } // anonymous namespace |
| 41 | 42 |
| 42 BackgroundBleedAvoidance BoxDecorationData::determineBackgroundBleedAvoidance(co nst LayoutBox& layoutBox) | 43 BackgroundBleedAvoidance BoxDecorationData::determineBackgroundBleedAvoidance(co nst LayoutBox& layoutBox) |
| 43 { | 44 { |
| 44 if (layoutBox.isDocumentElement()) | 45 if (layoutBox.isDocumentElement()) |
| 45 return BackgroundBleedNone; | 46 return BackgroundBleedNone; |
| 46 | 47 |
| 47 if (!hasBackground) | 48 if (!hasBackground) |
| 48 return BackgroundBleedNone; | 49 return BackgroundBleedNone; |
| 49 | 50 |
| 50 if (!hasBorderDecoration || !layoutBox.style()->hasBorderRadius() || layoutB ox.canRenderBorderImage()) { | 51 const ComputedStyle& boxStyle = layoutBox.styleRef(); |
| 52 const bool hasBorderRadius = boxStyle.hasBorderRadius(); | |
| 53 if (!hasBorderDecoration || !hasBorderRadius || layoutBox.canRenderBorderIma ge()) { | |
| 51 if (layoutBox.backgroundShouldAlwaysBeClipped()) | 54 if (layoutBox.backgroundShouldAlwaysBeClipped()) |
| 52 return BackgroundBleedClipOnly; | 55 return BackgroundBleedClipOnly; |
| 56 // Border radius clipping may require layer bleed avoidance if we are go ing to draw | |
| 57 // an image over something else, because we do not want the antialiasing to lead to bleeding | |
| 58 if (boxStyle.hasBackgroundImage() && hasBorderRadius) { | |
|
Stephen Chennney
2016/02/12 22:07:54
Have to make sure we have the background image bef
| |
| 59 // But if the top layer is opaque for the purposes of background pai nting, we do not | |
| 60 // need the bleed avoidance because we will not paint anything behin d the top layer. | |
| 61 if (!BoxPainter::isFillLayerOpaque(layoutBox.style()->backgroundLaye rs(), layoutBox)) | |
|
Stephen Chennney
2016/02/12 22:07:54
Have to use the same test as used in BoxPainter.
| |
| 62 return BackgroundBleedClipLayer; | |
| 63 } | |
| 53 return BackgroundBleedNone; | 64 return BackgroundBleedNone; |
| 54 } | 65 } |
| 55 | 66 |
| 56 if (borderObscuresBackgroundEdge(*layoutBox.style())) | 67 if (borderObscuresBackgroundEdge(boxStyle)) |
| 57 return BackgroundBleedShrinkBackground; | 68 return BackgroundBleedShrinkBackground; |
| 58 | 69 |
| 59 return BackgroundBleedClipLayer; | 70 return BackgroundBleedClipLayer; |
| 60 } | 71 } |
| 61 | 72 |
| 62 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |