OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 #include "core/css/CSSCustomIdentValue.h" | 36 #include "core/css/CSSCustomIdentValue.h" |
37 #include "core/css/CSSCustomPropertyDeclaration.h" | 37 #include "core/css/CSSCustomPropertyDeclaration.h" |
38 #include "core/css/CSSFontFaceSrcValue.h" | 38 #include "core/css/CSSFontFaceSrcValue.h" |
39 #include "core/css/CSSFontFamilyValue.h" | 39 #include "core/css/CSSFontFamilyValue.h" |
40 #include "core/css/CSSFontFeatureValue.h" | 40 #include "core/css/CSSFontFeatureValue.h" |
41 #include "core/css/CSSFunctionValue.h" | 41 #include "core/css/CSSFunctionValue.h" |
42 #include "core/css/CSSGradientValue.h" | 42 #include "core/css/CSSGradientValue.h" |
43 #include "core/css/CSSGridAutoRepeatValue.h" | 43 #include "core/css/CSSGridAutoRepeatValue.h" |
44 #include "core/css/CSSGridLineNamesValue.h" | 44 #include "core/css/CSSGridLineNamesValue.h" |
45 #include "core/css/CSSGridTemplateAreasValue.h" | 45 #include "core/css/CSSGridTemplateAreasValue.h" |
| 46 #include "core/css/CSSIdentifierValue.h" |
46 #include "core/css/CSSImageSetValue.h" | 47 #include "core/css/CSSImageSetValue.h" |
47 #include "core/css/CSSImageValue.h" | 48 #include "core/css/CSSImageValue.h" |
48 #include "core/css/CSSInheritedValue.h" | 49 #include "core/css/CSSInheritedValue.h" |
49 #include "core/css/CSSInitialValue.h" | 50 #include "core/css/CSSInitialValue.h" |
50 #include "core/css/CSSPaintValue.h" | 51 #include "core/css/CSSPaintValue.h" |
51 #include "core/css/CSSPathValue.h" | 52 #include "core/css/CSSPathValue.h" |
52 #include "core/css/CSSPendingSubstitutionValue.h" | 53 #include "core/css/CSSPendingSubstitutionValue.h" |
53 #include "core/css/CSSPrimitiveValue.h" | 54 #include "core/css/CSSPrimitiveValue.h" |
54 #include "core/css/CSSQuadValue.h" | 55 #include "core/css/CSSQuadValue.h" |
55 #include "core/css/CSSReflectValue.h" | 56 #include "core/css/CSSReflectValue.h" |
56 #include "core/css/CSSShadowValue.h" | 57 #include "core/css/CSSShadowValue.h" |
57 #include "core/css/CSSStringValue.h" | 58 #include "core/css/CSSStringValue.h" |
58 #include "core/css/CSSTimingFunctionValue.h" | 59 #include "core/css/CSSTimingFunctionValue.h" |
59 #include "core/css/CSSURIValue.h" | 60 #include "core/css/CSSURIValue.h" |
60 #include "core/css/CSSUnicodeRangeValue.h" | 61 #include "core/css/CSSUnicodeRangeValue.h" |
61 #include "core/css/CSSUnsetValue.h" | 62 #include "core/css/CSSUnsetValue.h" |
62 #include "core/css/CSSValueList.h" | 63 #include "core/css/CSSValueList.h" |
63 #include "core/css/CSSValuePair.h" | 64 #include "core/css/CSSValuePair.h" |
64 #include "core/css/CSSVariableReferenceValue.h" | 65 #include "core/css/CSSVariableReferenceValue.h" |
| 66 #include "platform/Length.h" |
65 #include "wtf/SizeAssertions.h" | 67 #include "wtf/SizeAssertions.h" |
66 | 68 |
67 namespace blink { | 69 namespace blink { |
68 | 70 |
69 struct SameSizeAsCSSValue : public GarbageCollectedFinalized<SameSizeAsCSSValue>
{ | 71 struct SameSizeAsCSSValue : public GarbageCollectedFinalized<SameSizeAsCSSValue>
{ |
70 uint32_t bitfields; | 72 uint32_t bitfields; |
71 }; | 73 }; |
72 ASSERT_SIZE(CSSValue, SameSizeAsCSSValue); | 74 ASSERT_SIZE(CSSValue, SameSizeAsCSSValue); |
73 | 75 |
| 76 CSSValue* CSSValue::create(const Length& value, float zoom) |
| 77 { |
| 78 switch (value.type()) { |
| 79 case Auto: |
| 80 case MinContent: |
| 81 case MaxContent: |
| 82 case FillAvailable: |
| 83 case FitContent: |
| 84 case ExtendToZoom: |
| 85 return CSSIdentifierValue::create(value); |
| 86 case Percent: |
| 87 case Fixed: |
| 88 case Calculated: |
| 89 return CSSPrimitiveValue::create(value, zoom); |
| 90 case DeviceWidth: |
| 91 case DeviceHeight: |
| 92 case MaxSizeNone: |
| 93 NOTREACHED(); |
| 94 break; |
| 95 } |
| 96 return nullptr; |
| 97 } |
| 98 |
74 bool CSSValue::isImplicitInitialValue() const | 99 bool CSSValue::isImplicitInitialValue() const |
75 { | 100 { |
76 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); | 101 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); |
77 } | 102 } |
78 | 103 |
79 bool CSSValue::hasFailedOrCanceledSubresources() const | 104 bool CSSValue::hasFailedOrCanceledSubresources() const |
80 { | 105 { |
81 if (isValueList()) | 106 if (isValueList()) |
82 return toCSSValueList(this)->hasFailedOrCanceledSubresources(); | 107 return toCSSValueList(this)->hasFailedOrCanceledSubresources(); |
83 if (getClassType() == FontFaceSrcClass) | 108 if (getClassType() == FontFaceSrcClass) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 case GridAutoRepeatClass: | 172 case GridAutoRepeatClass: |
148 return compareCSSValues<CSSGridAutoRepeatValue>(*this, other); | 173 return compareCSSValues<CSSGridAutoRepeatValue>(*this, other); |
149 case GridLineNamesClass: | 174 case GridLineNamesClass: |
150 return compareCSSValues<CSSGridLineNamesValue>(*this, other); | 175 return compareCSSValues<CSSGridLineNamesValue>(*this, other); |
151 case GridTemplateAreasClass: | 176 case GridTemplateAreasClass: |
152 return compareCSSValues<CSSGridTemplateAreasValue>(*this, other); | 177 return compareCSSValues<CSSGridTemplateAreasValue>(*this, other); |
153 case PathClass: | 178 case PathClass: |
154 return compareCSSValues<CSSPathValue>(*this, other); | 179 return compareCSSValues<CSSPathValue>(*this, other); |
155 case PrimitiveClass: | 180 case PrimitiveClass: |
156 return compareCSSValues<CSSPrimitiveValue>(*this, other); | 181 return compareCSSValues<CSSPrimitiveValue>(*this, other); |
| 182 case IdentifierClass: |
| 183 return compareCSSValues<CSSIdentifierValue>(*this, other); |
157 case QuadClass: | 184 case QuadClass: |
158 return compareCSSValues<CSSQuadValue>(*this, other); | 185 return compareCSSValues<CSSQuadValue>(*this, other); |
159 case ReflectClass: | 186 case ReflectClass: |
160 return compareCSSValues<CSSReflectValue>(*this, other); | 187 return compareCSSValues<CSSReflectValue>(*this, other); |
161 case ShadowClass: | 188 case ShadowClass: |
162 return compareCSSValues<CSSShadowValue>(*this, other); | 189 return compareCSSValues<CSSShadowValue>(*this, other); |
163 case StringClass: | 190 case StringClass: |
164 return compareCSSValues<CSSStringValue>(*this, other); | 191 return compareCSSValues<CSSStringValue>(*this, other); |
165 case CubicBezierTimingFunctionClass: | 192 case CubicBezierTimingFunctionClass: |
166 return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, ot
her); | 193 return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, ot
her); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 case GridAutoRepeatClass: | 266 case GridAutoRepeatClass: |
240 return toCSSGridAutoRepeatValue(this)->customCSSText(); | 267 return toCSSGridAutoRepeatValue(this)->customCSSText(); |
241 case GridLineNamesClass: | 268 case GridLineNamesClass: |
242 return toCSSGridLineNamesValue(this)->customCSSText(); | 269 return toCSSGridLineNamesValue(this)->customCSSText(); |
243 case GridTemplateAreasClass: | 270 case GridTemplateAreasClass: |
244 return toCSSGridTemplateAreasValue(this)->customCSSText(); | 271 return toCSSGridTemplateAreasValue(this)->customCSSText(); |
245 case PathClass: | 272 case PathClass: |
246 return toCSSPathValue(this)->customCSSText(); | 273 return toCSSPathValue(this)->customCSSText(); |
247 case PrimitiveClass: | 274 case PrimitiveClass: |
248 return toCSSPrimitiveValue(this)->customCSSText(); | 275 return toCSSPrimitiveValue(this)->customCSSText(); |
| 276 case IdentifierClass: |
| 277 return toCSSIdentifierValue(this)->customCSSText(); |
249 case QuadClass: | 278 case QuadClass: |
250 return toCSSQuadValue(this)->customCSSText(); | 279 return toCSSQuadValue(this)->customCSSText(); |
251 case ReflectClass: | 280 case ReflectClass: |
252 return toCSSReflectValue(this)->customCSSText(); | 281 return toCSSReflectValue(this)->customCSSText(); |
253 case ShadowClass: | 282 case ShadowClass: |
254 return toCSSShadowValue(this)->customCSSText(); | 283 return toCSSShadowValue(this)->customCSSText(); |
255 case StringClass: | 284 case StringClass: |
256 return toCSSStringValue(this)->customCSSText(); | 285 return toCSSStringValue(this)->customCSSText(); |
257 case CubicBezierTimingFunctionClass: | 286 case CubicBezierTimingFunctionClass: |
258 return toCSSCubicBezierTimingFunctionValue(this)->customCSSText(); | 287 return toCSSCubicBezierTimingFunctionValue(this)->customCSSText(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 return; | 384 return; |
356 case GridTemplateAreasClass: | 385 case GridTemplateAreasClass: |
357 toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue(); | 386 toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue(); |
358 return; | 387 return; |
359 case PathClass: | 388 case PathClass: |
360 toCSSPathValue(this)->~CSSPathValue(); | 389 toCSSPathValue(this)->~CSSPathValue(); |
361 return; | 390 return; |
362 case PrimitiveClass: | 391 case PrimitiveClass: |
363 toCSSPrimitiveValue(this)->~CSSPrimitiveValue(); | 392 toCSSPrimitiveValue(this)->~CSSPrimitiveValue(); |
364 return; | 393 return; |
| 394 case IdentifierClass: |
| 395 toCSSIdentifierValue(this)->~CSSIdentifierValue(); |
| 396 return; |
365 case QuadClass: | 397 case QuadClass: |
366 toCSSQuadValue(this)->~CSSQuadValue(); | 398 toCSSQuadValue(this)->~CSSQuadValue(); |
367 return; | 399 return; |
368 case ReflectClass: | 400 case ReflectClass: |
369 toCSSReflectValue(this)->~CSSReflectValue(); | 401 toCSSReflectValue(this)->~CSSReflectValue(); |
370 return; | 402 return; |
371 case ShadowClass: | 403 case ShadowClass: |
372 toCSSShadowValue(this)->~CSSShadowValue(); | 404 toCSSShadowValue(this)->~CSSShadowValue(); |
373 return; | 405 return; |
374 case StringClass: | 406 case StringClass: |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 return; | 517 return; |
486 case GridTemplateAreasClass: | 518 case GridTemplateAreasClass: |
487 toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor); | 519 toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor); |
488 return; | 520 return; |
489 case PathClass: | 521 case PathClass: |
490 toCSSPathValue(this)->traceAfterDispatch(visitor); | 522 toCSSPathValue(this)->traceAfterDispatch(visitor); |
491 return; | 523 return; |
492 case PrimitiveClass: | 524 case PrimitiveClass: |
493 toCSSPrimitiveValue(this)->traceAfterDispatch(visitor); | 525 toCSSPrimitiveValue(this)->traceAfterDispatch(visitor); |
494 return; | 526 return; |
| 527 case IdentifierClass: |
| 528 toCSSIdentifierValue(this)->traceAfterDispatch(visitor); |
| 529 return; |
495 case QuadClass: | 530 case QuadClass: |
496 toCSSQuadValue(this)->traceAfterDispatch(visitor); | 531 toCSSQuadValue(this)->traceAfterDispatch(visitor); |
497 return; | 532 return; |
498 case ReflectClass: | 533 case ReflectClass: |
499 toCSSReflectValue(this)->traceAfterDispatch(visitor); | 534 toCSSReflectValue(this)->traceAfterDispatch(visitor); |
500 return; | 535 return; |
501 case ShadowClass: | 536 case ShadowClass: |
502 toCSSShadowValue(this)->traceAfterDispatch(visitor); | 537 toCSSShadowValue(this)->traceAfterDispatch(visitor); |
503 return; | 538 return; |
504 case StringClass: | 539 case StringClass: |
(...skipping 30 matching lines...) Expand all Loading... |
535 toCSSCustomPropertyDeclaration(this)->traceAfterDispatch(visitor); | 570 toCSSCustomPropertyDeclaration(this)->traceAfterDispatch(visitor); |
536 return; | 571 return; |
537 case PendingSubstitutionValueClass: | 572 case PendingSubstitutionValueClass: |
538 toCSSPendingSubstitutionValue(this)->traceAfterDispatch(visitor); | 573 toCSSPendingSubstitutionValue(this)->traceAfterDispatch(visitor); |
539 return; | 574 return; |
540 } | 575 } |
541 ASSERT_NOT_REACHED(); | 576 ASSERT_NOT_REACHED(); |
542 } | 577 } |
543 | 578 |
544 } // namespace blink | 579 } // namespace blink |
OLD | NEW |