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

Side by Side Diff: third_party/WebKit/Source/core/paint/BoxDecorationData.cpp

Issue 2842983002: [LayoutNG] Paint inlines from the fragment tree
Patch Set: Rebase w/HEAD Created 3 years, 6 months 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 // 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/layout/ng/ng_physical_fragment.h"
8 #include "core/paint/BoxPainter.h" 9 #include "core/paint/BoxPainter.h"
9 #include "core/style/BorderEdge.h" 10 #include "core/style/BorderEdge.h"
10 #include "core/style/ComputedStyle.h" 11 #include "core/style/ComputedStyle.h"
11 #include "platform/RuntimeEnabledFeatures.h" 12 #include "platform/RuntimeEnabledFeatures.h"
12 #include "platform/graphics/GraphicsContext.h" 13 #include "platform/graphics/GraphicsContext.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 BoxDecorationData::BoxDecorationData(const LayoutBox& layout_box) { 17 BoxDecorationData::BoxDecorationData(const LayoutBox& layout_box)
17 background_color = 18 : BoxDecorationData(layout_box.Style()) {
18 layout_box.Style()->VisitedDependentColor(CSSPropertyBackgroundColor);
19 has_background =
20 background_color.Alpha() || layout_box.Style()->HasBackgroundImage();
21 DCHECK(has_background == layout_box.Style()->HasBackground());
22 has_border_decoration = layout_box.Style()->HasBorderDecoration();
23 has_appearance = layout_box.Style()->HasAppearance();
24 bleed_avoidance = DetermineBackgroundBleedAvoidance(layout_box); 19 bleed_avoidance = DetermineBackgroundBleedAvoidance(layout_box);
25 } 20 }
26 21
22 BoxDecorationData::BoxDecorationData(const NGPhysicalFragment* fragment)
23 : BoxDecorationData(&fragment->Style()) {
24 // TODO(layout-dev): Implement
25 bleed_avoidance = kBackgroundBleedClipLayer;
26 }
27
28 BoxDecorationData::BoxDecorationData(const ComputedStyle* style) {
29 background_color = style->VisitedDependentColor(CSSPropertyBackgroundColor);
30 has_background = background_color.Alpha() || style->HasBackgroundImage();
31 DCHECK(has_background == style->HasBackground());
32 has_border_decoration = style->HasBorderDecoration();
33 has_appearance = style->HasAppearance();
34 }
35
27 namespace { 36 namespace {
28 37
29 bool BorderObscuresBackgroundEdge(const ComputedStyle& style) { 38 bool BorderObscuresBackgroundEdge(const ComputedStyle& style) {
30 BorderEdge edges[4]; 39 BorderEdge edges[4];
31 style.GetBorderEdgeInfo(edges); 40 style.GetBorderEdgeInfo(edges);
32 41
33 for (auto& edge : edges) { 42 for (auto& edge : edges) {
34 if (!edge.ObscuresBackgroundEdge()) 43 if (!edge.ObscuresBackgroundEdge())
35 return false; 44 return false;
36 } 45 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return kBackgroundBleedNone; 80 return kBackgroundBleedNone;
72 } 81 }
73 82
74 if (BorderObscuresBackgroundEdge(box_style)) 83 if (BorderObscuresBackgroundEdge(box_style))
75 return kBackgroundBleedShrinkBackground; 84 return kBackgroundBleedShrinkBackground;
76 85
77 return kBackgroundBleedClipLayer; 86 return kBackgroundBleedClipLayer;
78 } 87 }
79 88
80 } // namespace blink 89 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698