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

Side by Side Diff: Source/core/layout/style/SVGComputedStyle.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2010 Rob Buis <buis@kde.org> 3 2004, 2005, 2010 Rob Buis <buis@kde.org>
4 Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 5
6 Based on khtml code by: 6 Based on khtml code by:
7 Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 7 Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
8 Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) 8 Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
9 Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org) 9 Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org)
10 Copyright (C) 2002 Apple Computer, Inc. 10 Copyright (C) 2002 Apple Computer, Inc.
11 11
12 This library is free software; you can redistribute it and/or 12 This library is free software; you can redistribute it and/or
13 modify it under the terms of the GNU Library General Public 13 modify it under the terms of the GNU Library General Public
14 License as published by the Free Software Foundation; either 14 License as published by the Free Software Foundation; either
15 version 2 of the License, or (at your option) any later version. 15 version 2 of the License, or (at your option) any later version.
16 16
17 This library is distributed in the hope that it will be useful, 17 This library is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Library General Public License for more details. 20 Library General Public License for more details.
21 21
22 You should have received a copy of the GNU Library General Public License 22 You should have received a copy of the GNU Library General Public License
23 along with this library; see the file COPYING.LIB. If not, write to 23 along with this library; see the file COPYING.LIB. If not, write to
24 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 Boston, MA 02110-1301, USA. 25 Boston, MA 02110-1301, USA.
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 29
30 #include "core/layout/style/SVGLayoutStyle.h" 30 #include "core/layout/style/SVGComputedStyle.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 SVGLayoutStyle::SVGLayoutStyle() 34 SVGComputedStyle::SVGComputedStyle()
35 { 35 {
36 static SVGLayoutStyle* initialStyle = new SVGLayoutStyle(CreateInitial); 36 static SVGComputedStyle* initialStyle = new SVGComputedStyle(CreateInitial);
37 37
38 fill = initialStyle->fill; 38 fill = initialStyle->fill;
39 stroke = initialStyle->stroke; 39 stroke = initialStyle->stroke;
40 stops = initialStyle->stops; 40 stops = initialStyle->stops;
41 misc = initialStyle->misc; 41 misc = initialStyle->misc;
42 inheritedResources = initialStyle->inheritedResources; 42 inheritedResources = initialStyle->inheritedResources;
43 layout = initialStyle->layout; 43 layout = initialStyle->layout;
44 resources = initialStyle->resources; 44 resources = initialStyle->resources;
45 45
46 setBitDefaults(); 46 setBitDefaults();
47 } 47 }
48 48
49 SVGLayoutStyle::SVGLayoutStyle(CreateInitialType) 49 SVGComputedStyle::SVGComputedStyle(CreateInitialType)
50 { 50 {
51 setBitDefaults(); 51 setBitDefaults();
52 52
53 fill.init(); 53 fill.init();
54 stroke.init(); 54 stroke.init();
55 stops.init(); 55 stops.init();
56 misc.init(); 56 misc.init();
57 inheritedResources.init(); 57 inheritedResources.init();
58 layout.init(); 58 layout.init();
59 resources.init(); 59 resources.init();
60 } 60 }
61 61
62 SVGLayoutStyle::SVGLayoutStyle(const SVGLayoutStyle& other) 62 SVGComputedStyle::SVGComputedStyle(const SVGComputedStyle& other)
63 : RefCounted<SVGLayoutStyle>() 63 : RefCounted<SVGComputedStyle>()
64 { 64 {
65 fill = other.fill; 65 fill = other.fill;
66 stroke = other.stroke; 66 stroke = other.stroke;
67 stops = other.stops; 67 stops = other.stops;
68 misc = other.misc; 68 misc = other.misc;
69 inheritedResources = other.inheritedResources; 69 inheritedResources = other.inheritedResources;
70 layout = other.layout; 70 layout = other.layout;
71 resources = other.resources; 71 resources = other.resources;
72 72
73 svg_inherited_flags = other.svg_inherited_flags; 73 svg_inherited_flags = other.svg_inherited_flags;
74 svg_noninherited_flags = other.svg_noninherited_flags; 74 svg_noninherited_flags = other.svg_noninherited_flags;
75 } 75 }
76 76
77 SVGLayoutStyle::~SVGLayoutStyle() 77 SVGComputedStyle::~SVGComputedStyle()
78 { 78 {
79 } 79 }
80 80
81 bool SVGLayoutStyle::operator==(const SVGLayoutStyle& other) const 81 bool SVGComputedStyle::operator==(const SVGComputedStyle& other) const
82 { 82 {
83 return fill == other.fill 83 return fill == other.fill
84 && stroke == other.stroke 84 && stroke == other.stroke
85 && stops == other.stops 85 && stops == other.stops
86 && misc == other.misc 86 && misc == other.misc
87 && inheritedResources == other.inheritedResources 87 && inheritedResources == other.inheritedResources
88 && layout == other.layout 88 && layout == other.layout
89 && resources == other.resources 89 && resources == other.resources
90 && svg_inherited_flags == other.svg_inherited_flags 90 && svg_inherited_flags == other.svg_inherited_flags
91 && svg_noninherited_flags == other.svg_noninherited_flags; 91 && svg_noninherited_flags == other.svg_noninherited_flags;
92 } 92 }
93 93
94 bool SVGLayoutStyle::inheritedNotEqual(const SVGLayoutStyle* other) const 94 bool SVGComputedStyle::inheritedNotEqual(const SVGComputedStyle* other) const
95 { 95 {
96 return fill != other->fill 96 return fill != other->fill
97 || stroke != other->stroke 97 || stroke != other->stroke
98 || inheritedResources != other->inheritedResources 98 || inheritedResources != other->inheritedResources
99 || svg_inherited_flags != other->svg_inherited_flags; 99 || svg_inherited_flags != other->svg_inherited_flags;
100 } 100 }
101 101
102 void SVGLayoutStyle::inheritFrom(const SVGLayoutStyle* svgInheritParent) 102 void SVGComputedStyle::inheritFrom(const SVGComputedStyle* svgInheritParent)
103 { 103 {
104 if (!svgInheritParent) 104 if (!svgInheritParent)
105 return; 105 return;
106 106
107 fill = svgInheritParent->fill; 107 fill = svgInheritParent->fill;
108 stroke = svgInheritParent->stroke; 108 stroke = svgInheritParent->stroke;
109 inheritedResources = svgInheritParent->inheritedResources; 109 inheritedResources = svgInheritParent->inheritedResources;
110 110
111 svg_inherited_flags = svgInheritParent->svg_inherited_flags; 111 svg_inherited_flags = svgInheritParent->svg_inherited_flags;
112 } 112 }
113 113
114 void SVGLayoutStyle::copyNonInheritedFromCached(const SVGLayoutStyle* other) 114 void SVGComputedStyle::copyNonInheritedFromCached(const SVGComputedStyle* other)
115 { 115 {
116 svg_noninherited_flags = other->svg_noninherited_flags; 116 svg_noninherited_flags = other->svg_noninherited_flags;
117 stops = other->stops; 117 stops = other->stops;
118 misc = other->misc; 118 misc = other->misc;
119 layout = other->layout; 119 layout = other->layout;
120 resources = other->resources; 120 resources = other->resources;
121 } 121 }
122 122
123 PassRefPtr<SVGDashArray> SVGLayoutStyle::initialStrokeDashArray() 123 PassRefPtr<SVGDashArray> SVGComputedStyle::initialStrokeDashArray()
124 { 124 {
125 DEFINE_STATIC_REF(SVGDashArray, initialDashArray, SVGDashArray::create()); 125 DEFINE_STATIC_REF(SVGDashArray, initialDashArray, SVGDashArray::create());
126 return initialDashArray; 126 return initialDashArray;
127 } 127 }
128 128
129 StyleDifference SVGLayoutStyle::diff(const SVGLayoutStyle* other) const 129 StyleDifference SVGComputedStyle::diff(const SVGComputedStyle* other) const
130 { 130 {
131 StyleDifference styleDifference; 131 StyleDifference styleDifference;
132 132
133 if (diffNeedsLayoutAndPaintInvalidation(other)) { 133 if (diffNeedsLayoutAndPaintInvalidation(other)) {
134 styleDifference.setNeedsFullLayout(); 134 styleDifference.setNeedsFullLayout();
135 styleDifference.setNeedsPaintInvalidationObject(); 135 styleDifference.setNeedsPaintInvalidationObject();
136 } else if (diffNeedsPaintInvalidation(other)) { 136 } else if (diffNeedsPaintInvalidation(other)) {
137 styleDifference.setNeedsPaintInvalidationObject(); 137 styleDifference.setNeedsPaintInvalidationObject();
138 } 138 }
139 139
140 return styleDifference; 140 return styleDifference;
141 } 141 }
142 142
143 bool SVGLayoutStyle::diffNeedsLayoutAndPaintInvalidation(const SVGLayoutStyle* o ther) const 143 bool SVGComputedStyle::diffNeedsLayoutAndPaintInvalidation(const SVGComputedStyl e* other) const
144 { 144 {
145 // If resources change, we need a relayout, as the presence of resources inf luences the paint invalidation rect. 145 // If resources change, we need a relayout, as the presence of resources inf luences the paint invalidation rect.
146 if (resources != other->resources) 146 if (resources != other->resources)
147 return true; 147 return true;
148 148
149 // If markers change, we need a relayout, as marker boundaries are cached in LayoutSVGPath. 149 // If markers change, we need a relayout, as marker boundaries are cached in LayoutSVGPath.
150 if (inheritedResources != other->inheritedResources) 150 if (inheritedResources != other->inheritedResources)
151 return true; 151 return true;
152 152
153 // All text related properties influence layout. 153 // All text related properties influence layout.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 || layout->rx != other->layout->rx 196 || layout->rx != other->layout->rx
197 || layout->ry != other->layout->ry 197 || layout->ry != other->layout->ry
198 || layout->cx != other->layout->cx 198 || layout->cx != other->layout->cx
199 || layout->cy != other->layout->cy) 199 || layout->cy != other->layout->cy)
200 return true; 200 return true;
201 } 201 }
202 202
203 return false; 203 return false;
204 } 204 }
205 205
206 bool SVGLayoutStyle::diffNeedsPaintInvalidation(const SVGLayoutStyle* other) con st 206 bool SVGComputedStyle::diffNeedsPaintInvalidation(const SVGComputedStyle* other) const
207 { 207 {
208 if (stroke->opacity != other->stroke->opacity) 208 if (stroke->opacity != other->stroke->opacity)
209 return true; 209 return true;
210 210
211 // Painting related properties only need paint invalidation. 211 // Painting related properties only need paint invalidation.
212 if (misc.get() != other->misc.get()) { 212 if (misc.get() != other->misc.get()) {
213 if (misc->floodColor != other->misc->floodColor 213 if (misc->floodColor != other->misc->floodColor
214 || misc->floodOpacity != other->misc->floodOpacity 214 || misc->floodOpacity != other->misc->floodOpacity
215 || misc->lightingColor != other->misc->lightingColor) 215 || misc->lightingColor != other->misc->lightingColor)
216 return true; 216 return true;
(...skipping 24 matching lines...) Expand all
241 241
242 if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_fl ags.f.bufferedRendering) 242 if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_fl ags.f.bufferedRendering)
243 return true; 243 return true;
244 244
245 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.mas kType) 245 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.mas kType)
246 return true; 246 return true;
247 247
248 return false; 248 return false;
249 } 249 }
250 250
251 EPaintOrderType SVGLayoutStyle::paintOrderType(unsigned index) const 251 EPaintOrderType SVGComputedStyle::paintOrderType(unsigned index) const
252 { 252 {
253 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); 253 ASSERT(index < ((1 << kPaintOrderBitwidth)-1));
254 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint OrderBitwidth) - 1); 254 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint OrderBitwidth) - 1);
255 return (EPaintOrderType)pt; 255 return (EPaintOrderType)pt;
256 } 256 }
257 257
258 } 258 }
OLDNEW
« no previous file with comments | « Source/core/layout/style/SVGComputedStyle.h ('k') | Source/core/layout/style/SVGComputedStyleDefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698