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

Side by Side Diff: sky/engine/core/css/StyleRule.cpp

Issue 654693004: Remove meta viewport and @viewport CSS rules. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 10 matching lines...) Expand all
21 21
22 #include "config.h" 22 #include "config.h"
23 #include "core/css/StyleRule.h" 23 #include "core/css/StyleRule.h"
24 24
25 #include "core/css/CSSFilterRule.h" 25 #include "core/css/CSSFilterRule.h"
26 #include "core/css/CSSFontFaceRule.h" 26 #include "core/css/CSSFontFaceRule.h"
27 #include "core/css/CSSKeyframesRule.h" 27 #include "core/css/CSSKeyframesRule.h"
28 #include "core/css/CSSMediaRule.h" 28 #include "core/css/CSSMediaRule.h"
29 #include "core/css/CSSStyleRule.h" 29 #include "core/css/CSSStyleRule.h"
30 #include "core/css/CSSSupportsRule.h" 30 #include "core/css/CSSSupportsRule.h"
31 #include "core/css/CSSViewportRule.h"
32 #include "core/css/StylePropertySet.h" 31 #include "core/css/StylePropertySet.h"
33 32
34 namespace blink { 33 namespace blink {
35 34
36 struct SameSizeAsStyleRuleBase : public RefCountedWillBeGarbageCollectedFinalize d<SameSizeAsStyleRuleBase> { 35 struct SameSizeAsStyleRuleBase : public RefCountedWillBeGarbageCollectedFinalize d<SameSizeAsStyleRuleBase> {
37 unsigned bitfields; 36 unsigned bitfields;
38 }; 37 };
39 38
40 COMPILE_ASSERT(sizeof(StyleRuleBase) <= sizeof(SameSizeAsStyleRuleBase), StyleRu leBase_should_stay_small); 39 COMPILE_ASSERT(sizeof(StyleRuleBase) <= sizeof(SameSizeAsStyleRuleBase), StyleRu leBase_should_stay_small);
41 40
(...skipping 18 matching lines...) Expand all
60 return; 59 return;
61 case Media: 60 case Media:
62 toStyleRuleMedia(this)->traceAfterDispatch(visitor); 61 toStyleRuleMedia(this)->traceAfterDispatch(visitor);
63 return; 62 return;
64 case Supports: 63 case Supports:
65 toStyleRuleSupports(this)->traceAfterDispatch(visitor); 64 toStyleRuleSupports(this)->traceAfterDispatch(visitor);
66 return; 65 return;
67 case Keyframes: 66 case Keyframes:
68 toStyleRuleKeyframes(this)->traceAfterDispatch(visitor); 67 toStyleRuleKeyframes(this)->traceAfterDispatch(visitor);
69 return; 68 return;
70 case Viewport:
71 toStyleRuleViewport(this)->traceAfterDispatch(visitor);
72 return;
73 case Filter: 69 case Filter:
74 toStyleRuleFilter(this)->traceAfterDispatch(visitor); 70 toStyleRuleFilter(this)->traceAfterDispatch(visitor);
75 return; 71 return;
76 case Unknown: 72 case Unknown:
77 case Keyframe: 73 case Keyframe:
78 ASSERT_NOT_REACHED(); 74 ASSERT_NOT_REACHED();
79 return; 75 return;
80 } 76 }
81 ASSERT_NOT_REACHED(); 77 ASSERT_NOT_REACHED();
82 } 78 }
83 79
84 void StyleRuleBase::finalizeGarbageCollectedObject() 80 void StyleRuleBase::finalizeGarbageCollectedObject()
85 { 81 {
86 switch (type()) { 82 switch (type()) {
87 case Style: 83 case Style:
88 toStyleRule(this)->~StyleRule(); 84 toStyleRule(this)->~StyleRule();
89 return; 85 return;
90 case FontFace: 86 case FontFace:
91 toStyleRuleFontFace(this)->~StyleRuleFontFace(); 87 toStyleRuleFontFace(this)->~StyleRuleFontFace();
92 return; 88 return;
93 case Media: 89 case Media:
94 toStyleRuleMedia(this)->~StyleRuleMedia(); 90 toStyleRuleMedia(this)->~StyleRuleMedia();
95 return; 91 return;
96 case Supports: 92 case Supports:
97 toStyleRuleSupports(this)->~StyleRuleSupports(); 93 toStyleRuleSupports(this)->~StyleRuleSupports();
98 return; 94 return;
99 case Keyframes: 95 case Keyframes:
100 toStyleRuleKeyframes(this)->~StyleRuleKeyframes(); 96 toStyleRuleKeyframes(this)->~StyleRuleKeyframes();
101 return; 97 return;
102 case Viewport:
103 toStyleRuleViewport(this)->~StyleRuleViewport();
104 return;
105 case Filter: 98 case Filter:
106 toStyleRuleFilter(this)->~StyleRuleFilter(); 99 toStyleRuleFilter(this)->~StyleRuleFilter();
107 return; 100 return;
108 case Unknown: 101 case Unknown:
109 case Keyframe: 102 case Keyframe:
110 ASSERT_NOT_REACHED(); 103 ASSERT_NOT_REACHED();
111 return; 104 return;
112 } 105 }
113 ASSERT_NOT_REACHED(); 106 ASSERT_NOT_REACHED();
114 } 107 }
115 108
116 void StyleRuleBase::destroy() 109 void StyleRuleBase::destroy()
117 { 110 {
118 switch (type()) { 111 switch (type()) {
119 case Style: 112 case Style:
120 delete toStyleRule(this); 113 delete toStyleRule(this);
121 return; 114 return;
122 case FontFace: 115 case FontFace:
123 delete toStyleRuleFontFace(this); 116 delete toStyleRuleFontFace(this);
124 return; 117 return;
125 case Media: 118 case Media:
126 delete toStyleRuleMedia(this); 119 delete toStyleRuleMedia(this);
127 return; 120 return;
128 case Supports: 121 case Supports:
129 delete toStyleRuleSupports(this); 122 delete toStyleRuleSupports(this);
130 return; 123 return;
131 case Keyframes: 124 case Keyframes:
132 delete toStyleRuleKeyframes(this); 125 delete toStyleRuleKeyframes(this);
133 return; 126 return;
134 case Viewport:
135 delete toStyleRuleViewport(this);
136 return;
137 case Filter: 127 case Filter:
138 delete toStyleRuleFilter(this); 128 delete toStyleRuleFilter(this);
139 return; 129 return;
140 case Unknown: 130 case Unknown:
141 case Keyframe: 131 case Keyframe:
142 ASSERT_NOT_REACHED(); 132 ASSERT_NOT_REACHED();
143 return; 133 return;
144 } 134 }
145 ASSERT_NOT_REACHED(); 135 ASSERT_NOT_REACHED();
146 } 136 }
147 137
148 PassRefPtrWillBeRawPtr<StyleRuleBase> StyleRuleBase::copy() const 138 PassRefPtrWillBeRawPtr<StyleRuleBase> StyleRuleBase::copy() const
149 { 139 {
150 switch (type()) { 140 switch (type()) {
151 case Style: 141 case Style:
152 return toStyleRule(this)->copy(); 142 return toStyleRule(this)->copy();
153 case FontFace: 143 case FontFace:
154 return toStyleRuleFontFace(this)->copy(); 144 return toStyleRuleFontFace(this)->copy();
155 case Media: 145 case Media:
156 return toStyleRuleMedia(this)->copy(); 146 return toStyleRuleMedia(this)->copy();
157 case Supports: 147 case Supports:
158 return toStyleRuleSupports(this)->copy(); 148 return toStyleRuleSupports(this)->copy();
159 case Keyframes: 149 case Keyframes:
160 return toStyleRuleKeyframes(this)->copy(); 150 return toStyleRuleKeyframes(this)->copy();
161 case Viewport:
162 return toStyleRuleViewport(this)->copy();
163 case Filter: 151 case Filter:
164 return toStyleRuleFilter(this)->copy(); 152 return toStyleRuleFilter(this)->copy();
165 case Unknown: 153 case Unknown:
166 case Keyframe: 154 case Keyframe:
167 ASSERT_NOT_REACHED(); 155 ASSERT_NOT_REACHED();
168 return nullptr; 156 return nullptr;
169 } 157 }
170 ASSERT_NOT_REACHED(); 158 ASSERT_NOT_REACHED();
171 return nullptr; 159 return nullptr;
172 } 160 }
(...skipping 11 matching lines...) Expand all
184 break; 172 break;
185 case Media: 173 case Media:
186 rule = CSSMediaRule::create(toStyleRuleMedia(self), parentSheet); 174 rule = CSSMediaRule::create(toStyleRuleMedia(self), parentSheet);
187 break; 175 break;
188 case Supports: 176 case Supports:
189 rule = CSSSupportsRule::create(toStyleRuleSupports(self), parentSheet); 177 rule = CSSSupportsRule::create(toStyleRuleSupports(self), parentSheet);
190 break; 178 break;
191 case Keyframes: 179 case Keyframes:
192 rule = CSSKeyframesRule::create(toStyleRuleKeyframes(self), parentSheet) ; 180 rule = CSSKeyframesRule::create(toStyleRuleKeyframes(self), parentSheet) ;
193 break; 181 break;
194 case Viewport:
195 rule = CSSViewportRule::create(toStyleRuleViewport(self), parentSheet);
196 break;
197 case Filter: 182 case Filter:
198 rule = CSSFilterRule::create(toStyleRuleFilter(self), parentSheet); 183 rule = CSSFilterRule::create(toStyleRuleFilter(self), parentSheet);
199 break; 184 break;
200 case Unknown: 185 case Unknown:
201 case Keyframe: 186 case Keyframe:
202 ASSERT_NOT_REACHED(); 187 ASSERT_NOT_REACHED();
203 return nullptr; 188 return nullptr;
204 } 189 }
205 if (parentRule) 190 if (parentRule)
206 rule->setParentRule(parentRule); 191 rule->setParentRule(parentRule);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 { 320 {
336 } 321 }
337 322
338 StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o) 323 StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o)
339 : StyleRuleGroup(o) 324 : StyleRuleGroup(o)
340 , m_conditionText(o.m_conditionText) 325 , m_conditionText(o.m_conditionText)
341 , m_conditionIsSupported(o.m_conditionIsSupported) 326 , m_conditionIsSupported(o.m_conditionIsSupported)
342 { 327 {
343 } 328 }
344 329
345 StyleRuleViewport::StyleRuleViewport()
346 : StyleRuleBase(Viewport)
347 {
348 }
349
350 StyleRuleViewport::StyleRuleViewport(const StyleRuleViewport& o)
351 : StyleRuleBase(o)
352 , m_properties(o.m_properties->mutableCopy())
353 {
354 }
355
356 StyleRuleViewport::~StyleRuleViewport()
357 {
358 }
359
360 MutableStylePropertySet& StyleRuleViewport::mutableProperties()
361 {
362 if (!m_properties->isMutable())
363 m_properties = m_properties->mutableCopy();
364 return *toMutableStylePropertySet(m_properties);
365 }
366
367 void StyleRuleViewport::setProperties(PassRefPtrWillBeRawPtr<StylePropertySet> p roperties)
368 {
369 m_properties = properties;
370 }
371
372 void StyleRuleViewport::traceAfterDispatch(Visitor* visitor)
373 {
374 visitor->trace(m_properties);
375 StyleRuleBase::traceAfterDispatch(visitor);
376 }
377
378 StyleRuleFilter::StyleRuleFilter(const String& filterName) 330 StyleRuleFilter::StyleRuleFilter(const String& filterName)
379 : StyleRuleBase(Filter) 331 : StyleRuleBase(Filter)
380 , m_filterName(filterName) 332 , m_filterName(filterName)
381 { 333 {
382 } 334 }
383 335
384 StyleRuleFilter::StyleRuleFilter(const StyleRuleFilter& o) 336 StyleRuleFilter::StyleRuleFilter(const StyleRuleFilter& o)
385 : StyleRuleBase(o) 337 : StyleRuleBase(o)
386 , m_filterName(o.m_filterName) 338 , m_filterName(o.m_filterName)
387 , m_properties(o.m_properties->mutableCopy()) 339 , m_properties(o.m_properties->mutableCopy())
(...skipping 16 matching lines...) Expand all
404 m_properties = properties; 356 m_properties = properties;
405 } 357 }
406 358
407 void StyleRuleFilter::traceAfterDispatch(Visitor* visitor) 359 void StyleRuleFilter::traceAfterDispatch(Visitor* visitor)
408 { 360 {
409 visitor->trace(m_properties); 361 visitor->trace(m_properties);
410 StyleRuleBase::traceAfterDispatch(visitor); 362 StyleRuleBase::traceAfterDispatch(visitor);
411 } 363 }
412 364
413 } // namespace blink 365 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698