Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "core/style/SVGComputedStyle.h" | 28 #include "core/style/SVGComputedStyle.h" |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 static const int kPaintOrderBitwidth = 2; | 32 static const int kPaintOrderBitwidth = 2; |
| 33 | 33 |
| 34 SVGComputedStyle::SVGComputedStyle() | 34 SVGComputedStyle::SVGComputedStyle() |
| 35 { | 35 { |
| 36 static SVGComputedStyle* initialStyle = new SVGComputedStyle(CreateInitial); | 36 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<SVGComputedStyle*>, style, |
|
esprehn
2016/09/12 20:53:12
ditto
| |
| 37 new ThreadSpecific<SVGComputedStyle*>); | |
| 38 if (!*style) { | |
| 39 *style = new SVGComputedStyle(CreateInitial); | |
| 40 } | |
| 41 | |
| 42 SVGComputedStyle* initialStyle = *style; | |
| 37 | 43 |
| 38 fill = initialStyle->fill; | 44 fill = initialStyle->fill; |
| 39 stroke = initialStyle->stroke; | 45 stroke = initialStyle->stroke; |
| 40 stops = initialStyle->stops; | 46 stops = initialStyle->stops; |
| 41 misc = initialStyle->misc; | 47 misc = initialStyle->misc; |
| 42 inheritedResources = initialStyle->inheritedResources; | 48 inheritedResources = initialStyle->inheritedResources; |
| 43 geometry = initialStyle->geometry; | 49 geometry = initialStyle->geometry; |
| 44 resources = initialStyle->resources; | 50 resources = initialStyle->resources; |
| 45 | 51 |
| 46 setBitDefaults(); | 52 setBitDefaults(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 { | 123 { |
| 118 svg_noninherited_flags = other->svg_noninherited_flags; | 124 svg_noninherited_flags = other->svg_noninherited_flags; |
| 119 stops = other->stops; | 125 stops = other->stops; |
| 120 misc = other->misc; | 126 misc = other->misc; |
| 121 geometry = other->geometry; | 127 geometry = other->geometry; |
| 122 resources = other->resources; | 128 resources = other->resources; |
| 123 } | 129 } |
| 124 | 130 |
| 125 PassRefPtr<SVGDashArray> SVGComputedStyle::initialStrokeDashArray() | 131 PassRefPtr<SVGDashArray> SVGComputedStyle::initialStrokeDashArray() |
| 126 { | 132 { |
| 127 DEFINE_STATIC_REF(SVGDashArray, initialDashArray, SVGDashArray::create()); | 133 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<SVGDashArray*>, initialDashAr ray, |
| 128 return initialDashArray; | 134 new ThreadSpecific<SVGDashArray*>()); |
| 135 if (!*initialDashArray) { | |
| 136 *initialDashArray = SVGDashArray::create().leakRef(); | |
| 137 } | |
| 138 return *initialDashArray; | |
| 129 } | 139 } |
| 130 | 140 |
| 131 StyleDifference SVGComputedStyle::diff(const SVGComputedStyle* other) const | 141 StyleDifference SVGComputedStyle::diff(const SVGComputedStyle* other) const |
| 132 { | 142 { |
| 133 StyleDifference styleDifference; | 143 StyleDifference styleDifference; |
| 134 | 144 |
| 135 if (diffNeedsLayoutAndPaintInvalidation(other)) { | 145 if (diffNeedsLayoutAndPaintInvalidation(other)) { |
| 136 styleDifference.setNeedsFullLayout(); | 146 styleDifference.setNeedsFullLayout(); |
| 137 styleDifference.setNeedsPaintInvalidationObject(); | 147 styleDifference.setNeedsPaintInvalidationObject(); |
| 138 } else if (diffNeedsPaintInvalidation(other)) { | 148 } else if (diffNeedsPaintInvalidation(other)) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 case PaintOrderMarkersStrokeFill: | 278 case PaintOrderMarkersStrokeFill: |
| 269 pt = paintOrderSequence(PT_MARKERS, PT_STROKE, PT_FILL); | 279 pt = paintOrderSequence(PT_MARKERS, PT_STROKE, PT_FILL); |
| 270 break; | 280 break; |
| 271 } | 281 } |
| 272 | 282 |
| 273 pt = (pt >> (kPaintOrderBitwidth*index)) & ((1u << kPaintOrderBitwidth) - 1) ; | 283 pt = (pt >> (kPaintOrderBitwidth*index)) & ((1u << kPaintOrderBitwidth) - 1) ; |
| 274 return (EPaintOrderType)pt; | 284 return (EPaintOrderType)pt; |
| 275 } | 285 } |
| 276 | 286 |
| 277 } // namespace blink | 287 } // namespace blink |
| OLD | NEW |