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

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

Issue 636993002: [CSS Grid Layout] Upgrade justify-content parsing to CSS3 Box Alignment spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Using a custom CSSValue to simplify parsing and style building. 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 * 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 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 * 24 *
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/css/CSSValue.h" 28 #include "core/css/CSSValue.h"
29 29
30 #include "core/css/CSSBorderImageSliceValue.h" 30 #include "core/css/CSSBorderImageSliceValue.h"
31 #include "core/css/CSSCalculationValue.h" 31 #include "core/css/CSSCalculationValue.h"
32 #include "core/css/CSSCanvasValue.h" 32 #include "core/css/CSSCanvasValue.h"
33 #include "core/css/CSSContentDistributionValue.h"
33 #include "core/css/CSSCrossfadeValue.h" 34 #include "core/css/CSSCrossfadeValue.h"
34 #include "core/css/CSSCursorImageValue.h" 35 #include "core/css/CSSCursorImageValue.h"
35 #include "core/css/CSSFilterValue.h" 36 #include "core/css/CSSFilterValue.h"
36 #include "core/css/CSSFontFaceSrcValue.h" 37 #include "core/css/CSSFontFaceSrcValue.h"
37 #include "core/css/CSSFontFeatureValue.h" 38 #include "core/css/CSSFontFeatureValue.h"
38 #include "core/css/CSSFontValue.h" 39 #include "core/css/CSSFontValue.h"
39 #include "core/css/CSSFunctionValue.h" 40 #include "core/css/CSSFunctionValue.h"
40 #include "core/css/CSSGradientValue.h" 41 #include "core/css/CSSGradientValue.h"
41 #include "core/css/CSSGridLineNamesValue.h" 42 #include "core/css/CSSGridLineNamesValue.h"
42 #include "core/css/CSSGridTemplateAreasValue.h" 43 #include "core/css/CSSGridTemplateAreasValue.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 case LineBoxContainClass: 203 case LineBoxContainClass:
203 return compareCSSValues<CSSLineBoxContainValue>(*this, other); 204 return compareCSSValues<CSSLineBoxContainValue>(*this, other);
204 case CalculationClass: 205 case CalculationClass:
205 return compareCSSValues<CSSCalcValue>(*this, other); 206 return compareCSSValues<CSSCalcValue>(*this, other);
206 case ImageSetClass: 207 case ImageSetClass:
207 return compareCSSValues<CSSImageSetValue>(*this, other); 208 return compareCSSValues<CSSImageSetValue>(*this, other);
208 case CSSFilterClass: 209 case CSSFilterClass:
209 return compareCSSValues<CSSFilterValue>(*this, other); 210 return compareCSSValues<CSSFilterValue>(*this, other);
210 case CSSSVGDocumentClass: 211 case CSSSVGDocumentClass:
211 return compareCSSValues<CSSSVGDocumentValue>(*this, other); 212 return compareCSSValues<CSSSVGDocumentValue>(*this, other);
213 case CSSContentDistributionClass:
214 return compareCSSValues<CSSContentDistributionValue>(*this, other);
212 default: 215 default:
213 ASSERT_NOT_REACHED(); 216 ASSERT_NOT_REACHED();
214 return false; 217 return false;
215 } 218 }
216 } else if (m_classType == ValueListClass && other.m_classType != ValueListCl ass) 219 } else if (m_classType == ValueListClass && other.m_classType != ValueListCl ass)
217 return toCSSValueList(this)->equals(other); 220 return toCSSValueList(this)->equals(other);
218 else if (m_classType != ValueListClass && other.m_classType == ValueListClas s) 221 else if (m_classType != ValueListClass && other.m_classType == ValueListClas s)
219 return static_cast<const CSSValueList&>(other).equals(*this); 222 return static_cast<const CSSValueList&>(other).equals(*this);
220 return false; 223 return false;
221 } 224 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 case LineBoxContainClass: 281 case LineBoxContainClass:
279 return toCSSLineBoxContainValue(this)->customCSSText(); 282 return toCSSLineBoxContainValue(this)->customCSSText();
280 case CalculationClass: 283 case CalculationClass:
281 return toCSSCalcValue(this)->customCSSText(); 284 return toCSSCalcValue(this)->customCSSText();
282 case ImageSetClass: 285 case ImageSetClass:
283 return toCSSImageSetValue(this)->customCSSText(); 286 return toCSSImageSetValue(this)->customCSSText();
284 case CSSFilterClass: 287 case CSSFilterClass:
285 return toCSSFilterValue(this)->customCSSText(); 288 return toCSSFilterValue(this)->customCSSText();
286 case CSSSVGDocumentClass: 289 case CSSSVGDocumentClass:
287 return toCSSSVGDocumentValue(this)->customCSSText(); 290 return toCSSSVGDocumentValue(this)->customCSSText();
291 case CSSContentDistributionClass:
292 return toCSSContentDistributionValue(this)->customCSSText();
288 } 293 }
289 ASSERT_NOT_REACHED(); 294 ASSERT_NOT_REACHED();
290 return String(); 295 return String();
291 } 296 }
292 297
293 void CSSValue::destroy() 298 void CSSValue::destroy()
294 { 299 {
295 if (m_isTextClone) { 300 if (m_isTextClone) {
296 ASSERT(isCSSOMSafe()); 301 ASSERT(isCSSOMSafe());
297 delete toTextCloneCSSValue(this); 302 delete toTextCloneCSSValue(this);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 delete toCSSCalcValue(this); 381 delete toCSSCalcValue(this);
377 return; 382 return;
378 case ImageSetClass: 383 case ImageSetClass:
379 delete toCSSImageSetValue(this); 384 delete toCSSImageSetValue(this);
380 return; 385 return;
381 case CSSFilterClass: 386 case CSSFilterClass:
382 delete toCSSFilterValue(this); 387 delete toCSSFilterValue(this);
383 return; 388 return;
384 case CSSSVGDocumentClass: 389 case CSSSVGDocumentClass:
385 delete toCSSSVGDocumentValue(this); 390 delete toCSSSVGDocumentValue(this);
391 case CSSContentDistributionClass:
392 delete toCSSContentDistributionValue(this);
386 return; 393 return;
387 } 394 }
388 ASSERT_NOT_REACHED(); 395 ASSERT_NOT_REACHED();
389 } 396 }
390 397
391 void CSSValue::finalizeGarbageCollectedObject() 398 void CSSValue::finalizeGarbageCollectedObject()
392 { 399 {
393 if (m_isTextClone) { 400 if (m_isTextClone) {
394 ASSERT(isCSSOMSafe()); 401 ASSERT(isCSSOMSafe());
395 toTextCloneCSSValue(this)->~TextCloneCSSValue(); 402 toTextCloneCSSValue(this)->~TextCloneCSSValue();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 return; 482 return;
476 case ImageSetClass: 483 case ImageSetClass:
477 toCSSImageSetValue(this)->~CSSImageSetValue(); 484 toCSSImageSetValue(this)->~CSSImageSetValue();
478 return; 485 return;
479 case CSSFilterClass: 486 case CSSFilterClass:
480 toCSSFilterValue(this)->~CSSFilterValue(); 487 toCSSFilterValue(this)->~CSSFilterValue();
481 return; 488 return;
482 case CSSSVGDocumentClass: 489 case CSSSVGDocumentClass:
483 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue(); 490 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue();
484 return; 491 return;
492 case CSSContentDistributionClass:
493 toCSSContentDistributionValue(this)->~CSSContentDistributionValue();
494 return;
485 } 495 }
486 ASSERT_NOT_REACHED(); 496 ASSERT_NOT_REACHED();
487 } 497 }
488 498
489 void CSSValue::trace(Visitor* visitor) 499 void CSSValue::trace(Visitor* visitor)
490 { 500 {
491 if (m_isTextClone) { 501 if (m_isTextClone) {
492 ASSERT(isCSSOMSafe()); 502 ASSERT(isCSSOMSafe());
493 toTextCloneCSSValue(this)->traceAfterDispatch(visitor); 503 toTextCloneCSSValue(this)->traceAfterDispatch(visitor);
494 return; 504 return;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 return; 583 return;
574 case ImageSetClass: 584 case ImageSetClass:
575 toCSSImageSetValue(this)->traceAfterDispatch(visitor); 585 toCSSImageSetValue(this)->traceAfterDispatch(visitor);
576 return; 586 return;
577 case CSSFilterClass: 587 case CSSFilterClass:
578 toCSSFilterValue(this)->traceAfterDispatch(visitor); 588 toCSSFilterValue(this)->traceAfterDispatch(visitor);
579 return; 589 return;
580 case CSSSVGDocumentClass: 590 case CSSSVGDocumentClass:
581 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor); 591 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor);
582 return; 592 return;
593 case CSSContentDistributionClass:
594 toCSSContentDistributionValue(this)->traceAfterDispatch(visitor);
595 return;
583 } 596 }
584 ASSERT_NOT_REACHED(); 597 ASSERT_NOT_REACHED();
585 } 598 }
586 599
587 PassRefPtrWillBeRawPtr<CSSValue> CSSValue::cloneForCSSOM() const 600 PassRefPtrWillBeRawPtr<CSSValue> CSSValue::cloneForCSSOM() const
588 { 601 {
589 switch (classType()) { 602 switch (classType()) {
590 case PrimitiveClass: 603 case PrimitiveClass:
591 return toCSSPrimitiveValue(this)->cloneForCSSOM(); 604 return toCSSPrimitiveValue(this)->cloneForCSSOM();
592 case ValueListClass: 605 case ValueListClass:
593 return toCSSValueList(this)->cloneForCSSOM(); 606 return toCSSValueList(this)->cloneForCSSOM();
594 case ImageClass: 607 case ImageClass:
595 case CursorImageClass: 608 case CursorImageClass:
596 return toCSSImageValue(this)->cloneForCSSOM(); 609 return toCSSImageValue(this)->cloneForCSSOM();
597 case CSSFilterClass: 610 case CSSFilterClass:
598 return toCSSFilterValue(this)->cloneForCSSOM(); 611 return toCSSFilterValue(this)->cloneForCSSOM();
599 case CSSTransformClass: 612 case CSSTransformClass:
600 return toCSSTransformValue(this)->cloneForCSSOM(); 613 return toCSSTransformValue(this)->cloneForCSSOM();
601 case ImageSetClass: 614 case ImageSetClass:
602 return toCSSImageSetValue(this)->cloneForCSSOM(); 615 return toCSSImageSetValue(this)->cloneForCSSOM();
603 default: 616 default:
604 ASSERT(!isSubtypeExposedToCSSOM()); 617 ASSERT(!isSubtypeExposedToCSSOM());
605 return TextCloneCSSValue::create(classType(), cssText()); 618 return TextCloneCSSValue::create(classType(), cssText());
606 } 619 }
607 } 620 }
608 621
609 } 622 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698