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

Side by Side Diff: Source/core/css/CSSValueObject.cpp

Issue 1225553002: CSSValue Immediates: Make CSSPrimitiveValue a container (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_1
Patch Set: Rebase Created 5 years, 4 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
« no previous file with comments | « Source/core/css/CSSValue.h ('k') | Source/core/css/CSSValuePool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) 2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org)
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "core/css/CSSValueList.h" 55 #include "core/css/CSSValueList.h"
56 56
57 namespace blink { 57 namespace blink {
58 58
59 struct SameSizeAsCSSValueObject : public RefCountedWillBeGarbageCollectedFinaliz ed<SameSizeAsCSSValueObject> { 59 struct SameSizeAsCSSValueObject : public RefCountedWillBeGarbageCollectedFinaliz ed<SameSizeAsCSSValueObject> {
60 uint32_t bitfields; 60 uint32_t bitfields;
61 }; 61 };
62 62
63 static_assert(sizeof(CSSValueObject) <= sizeof(SameSizeAsCSSValueObject), "CSSVa lueObject should stay small"); 63 static_assert(sizeof(CSSValueObject) <= sizeof(SameSizeAsCSSValueObject), "CSSVa lueObject should stay small");
64 64
65 // Only for use by CSSValueObject.
66 inline CSSPrimitiveValue::CSSLargePrimitiveValue* toCSSLargePrimitiveValue(CSSVa lueObject* value)
67 {
68 ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isPrimitiveValue());
69 return static_cast<CSSPrimitiveValue::CSSLargePrimitiveValue*>(value);
70 }
71 inline CSSPrimitiveValue toCSSPrimitiveValue(const CSSValueObject* value)
72 {
73 ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isPrimitiveValue());
74 return CSSPrimitiveValue(static_cast<const CSSPrimitiveValue::CSSLargePrimit iveValue*>(value));
75 }
76
65 bool CSSValueObject::isImplicitInitialValue() const 77 bool CSSValueObject::isImplicitInitialValue() const
66 { 78 {
67 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); 79 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit();
68 } 80 }
69 81
70 bool CSSValueObject::hasFailedOrCanceledSubresources() const 82 bool CSSValueObject::hasFailedOrCanceledSubresources() const
71 { 83 {
72 if (isValueList()) 84 if (isValueList())
73 return toCSSValueList(this)->hasFailedOrCanceledSubresources(); 85 return toCSSValueList(this)->hasFailedOrCanceledSubresources();
74 if (classType() == FontFaceSrcClass) 86 if (classType() == FontFaceSrcClass)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return compareCSSValues<CSSInitialValue>(*this, other); 131 return compareCSSValues<CSSInitialValue>(*this, other);
120 case UnsetClass: 132 case UnsetClass:
121 return compareCSSValues<CSSUnsetValue>(*this, other); 133 return compareCSSValues<CSSUnsetValue>(*this, other);
122 case GridLineNamesClass: 134 case GridLineNamesClass:
123 return compareCSSValues<CSSGridLineNamesValue>(*this, other); 135 return compareCSSValues<CSSGridLineNamesValue>(*this, other);
124 case GridTemplateAreasClass: 136 case GridTemplateAreasClass:
125 return compareCSSValues<CSSGridTemplateAreasValue>(*this, other); 137 return compareCSSValues<CSSGridTemplateAreasValue>(*this, other);
126 case PathClass: 138 case PathClass:
127 return compareCSSValues<CSSPathValue>(*this, other); 139 return compareCSSValues<CSSPathValue>(*this, other);
128 case PrimitiveClass: 140 case PrimitiveClass:
129 return compareCSSValues<CSSPrimitiveValue>(*this, other); 141 return toCSSPrimitiveValue(this).equals(toCSSPrimitiveValue(&other)) ;
130 case ReflectClass: 142 case ReflectClass:
131 return compareCSSValues<CSSReflectValue>(*this, other); 143 return compareCSSValues<CSSReflectValue>(*this, other);
132 case ShadowClass: 144 case ShadowClass:
133 return compareCSSValues<CSSShadowValue>(*this, other); 145 return compareCSSValues<CSSShadowValue>(*this, other);
134 case CubicBezierTimingFunctionClass: 146 case CubicBezierTimingFunctionClass:
135 return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, ot her); 147 return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, ot her);
136 case StepsTimingFunctionClass: 148 case StepsTimingFunctionClass:
137 return compareCSSValues<CSSStepsTimingFunctionValue>(*this, other); 149 return compareCSSValues<CSSStepsTimingFunctionValue>(*this, other);
138 case UnicodeRangeClass: 150 case UnicodeRangeClass:
139 return compareCSSValues<CSSUnicodeRangeValue>(*this, other); 151 return compareCSSValues<CSSUnicodeRangeValue>(*this, other);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return toCSSUnsetValue(this)->customCSSText(); 198 return toCSSUnsetValue(this)->customCSSText();
187 case InitialClass: 199 case InitialClass:
188 return toCSSInitialValue(this)->customCSSText(); 200 return toCSSInitialValue(this)->customCSSText();
189 case GridLineNamesClass: 201 case GridLineNamesClass:
190 return toCSSGridLineNamesValue(this)->customCSSText(); 202 return toCSSGridLineNamesValue(this)->customCSSText();
191 case GridTemplateAreasClass: 203 case GridTemplateAreasClass:
192 return toCSSGridTemplateAreasValue(this)->customCSSText(); 204 return toCSSGridTemplateAreasValue(this)->customCSSText();
193 case PathClass: 205 case PathClass:
194 return toCSSPathValue(this)->customCSSText(); 206 return toCSSPathValue(this)->customCSSText();
195 case PrimitiveClass: 207 case PrimitiveClass:
196 return toCSSPrimitiveValue(this)->customCSSText(); 208 return toCSSPrimitiveValue(this).customCSSText();
197 case ReflectClass: 209 case ReflectClass:
198 return toCSSReflectValue(this)->customCSSText(); 210 return toCSSReflectValue(this)->customCSSText();
199 case ShadowClass: 211 case ShadowClass:
200 return toCSSShadowValue(this)->customCSSText(); 212 return toCSSShadowValue(this)->customCSSText();
201 case CubicBezierTimingFunctionClass: 213 case CubicBezierTimingFunctionClass:
202 return toCSSCubicBezierTimingFunctionValue(this)->customCSSText(); 214 return toCSSCubicBezierTimingFunctionValue(this)->customCSSText();
203 case StepsTimingFunctionClass: 215 case StepsTimingFunctionClass:
204 return toCSSStepsTimingFunctionValue(this)->customCSSText(); 216 return toCSSStepsTimingFunctionValue(this)->customCSSText();
205 case UnicodeRangeClass: 217 case UnicodeRangeClass:
206 return toCSSUnicodeRangeValue(this)->customCSSText(); 218 return toCSSUnicodeRangeValue(this)->customCSSText();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 case GridLineNamesClass: 278 case GridLineNamesClass:
267 delete toCSSGridLineNamesValue(this); 279 delete toCSSGridLineNamesValue(this);
268 return; 280 return;
269 case GridTemplateAreasClass: 281 case GridTemplateAreasClass:
270 delete toCSSGridTemplateAreasValue(this); 282 delete toCSSGridTemplateAreasValue(this);
271 return; 283 return;
272 case PathClass: 284 case PathClass:
273 delete toCSSPathValue(this); 285 delete toCSSPathValue(this);
274 return; 286 return;
275 case PrimitiveClass: 287 case PrimitiveClass:
276 delete toCSSPrimitiveValue(this); 288 delete toCSSLargePrimitiveValue(this);
277 return; 289 return;
278 case ReflectClass: 290 case ReflectClass:
279 delete toCSSReflectValue(this); 291 delete toCSSReflectValue(this);
280 return; 292 return;
281 case ShadowClass: 293 case ShadowClass:
282 delete toCSSShadowValue(this); 294 delete toCSSShadowValue(this);
283 return; 295 return;
284 case CubicBezierTimingFunctionClass: 296 case CubicBezierTimingFunctionClass:
285 delete toCSSCubicBezierTimingFunctionValue(this); 297 delete toCSSCubicBezierTimingFunctionValue(this);
286 return; 298 return;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 case GridLineNamesClass: 369 case GridLineNamesClass:
358 toCSSGridLineNamesValue(this)->~CSSGridLineNamesValue(); 370 toCSSGridLineNamesValue(this)->~CSSGridLineNamesValue();
359 return; 371 return;
360 case GridTemplateAreasClass: 372 case GridTemplateAreasClass:
361 toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue(); 373 toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue();
362 return; 374 return;
363 case PathClass: 375 case PathClass:
364 toCSSPathValue(this)->~CSSPathValue(); 376 toCSSPathValue(this)->~CSSPathValue();
365 return; 377 return;
366 case PrimitiveClass: 378 case PrimitiveClass:
367 toCSSPrimitiveValue(this)->~CSSPrimitiveValue(); 379 toCSSLargePrimitiveValue(this)->~CSSLargePrimitiveValue();
368 return; 380 return;
369 case ReflectClass: 381 case ReflectClass:
370 toCSSReflectValue(this)->~CSSReflectValue(); 382 toCSSReflectValue(this)->~CSSReflectValue();
371 return; 383 return;
372 case ShadowClass: 384 case ShadowClass:
373 toCSSShadowValue(this)->~CSSShadowValue(); 385 toCSSShadowValue(this)->~CSSShadowValue();
374 return; 386 return;
375 case CubicBezierTimingFunctionClass: 387 case CubicBezierTimingFunctionClass:
376 toCSSCubicBezierTimingFunctionValue(this)->~CSSCubicBezierTimingFunction Value(); 388 toCSSCubicBezierTimingFunctionValue(this)->~CSSCubicBezierTimingFunction Value();
377 return; 389 return;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 case GridLineNamesClass: 460 case GridLineNamesClass:
449 toCSSGridLineNamesValue(this)->traceAfterDispatch(visitor); 461 toCSSGridLineNamesValue(this)->traceAfterDispatch(visitor);
450 return; 462 return;
451 case GridTemplateAreasClass: 463 case GridTemplateAreasClass:
452 toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor); 464 toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor);
453 return; 465 return;
454 case PathClass: 466 case PathClass:
455 toCSSPathValue(this)->traceAfterDispatch(visitor); 467 toCSSPathValue(this)->traceAfterDispatch(visitor);
456 return; 468 return;
457 case PrimitiveClass: 469 case PrimitiveClass:
458 toCSSPrimitiveValue(this)->traceAfterDispatch(visitor); 470 toCSSLargePrimitiveValue(this)->traceAfterDispatch(visitor);
459 return; 471 return;
460 case ReflectClass: 472 case ReflectClass:
461 toCSSReflectValue(this)->traceAfterDispatch(visitor); 473 toCSSReflectValue(this)->traceAfterDispatch(visitor);
462 return; 474 return;
463 case ShadowClass: 475 case ShadowClass:
464 toCSSShadowValue(this)->traceAfterDispatch(visitor); 476 toCSSShadowValue(this)->traceAfterDispatch(visitor);
465 return; 477 return;
466 case CubicBezierTimingFunctionClass: 478 case CubicBezierTimingFunctionClass:
467 toCSSCubicBezierTimingFunctionValue(this)->traceAfterDispatch(visitor); 479 toCSSCubicBezierTimingFunctionValue(this)->traceAfterDispatch(visitor);
468 return; 480 return;
(...skipping 19 matching lines...) Expand all
488 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor); 500 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor);
489 return; 501 return;
490 case CSSContentDistributionClass: 502 case CSSContentDistributionClass:
491 toCSSContentDistributionValue(this)->traceAfterDispatch(visitor); 503 toCSSContentDistributionValue(this)->traceAfterDispatch(visitor);
492 return; 504 return;
493 } 505 }
494 ASSERT_NOT_REACHED(); 506 ASSERT_NOT_REACHED();
495 } 507 }
496 508
497 } 509 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSValue.h ('k') | Source/core/css/CSSValuePool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698