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

Side by Side Diff: Source/core/css/StylePropertySerializer.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/RuleFeature.cpp ('k') | Source/core/css/StylePropertySet.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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 || shorthand.properties()[propertyIndex + 1] == CSSPropertyW ebkitMaskRepeatY); 651 || shorthand.properties()[propertyIndex + 1] == CSSPropertyW ebkitMaskRepeatY);
652 NullableCSSValue yValue = values[propertyIndex + 1]->isValueList () ? 652 NullableCSSValue yValue = values[propertyIndex + 1]->isValueList () ?
653 toCSSValueList(values[propertyIndex + 1])->item(layer) : val ues[propertyIndex + 1]; 653 toCSSValueList(values[propertyIndex + 1])->item(layer) : val ues[propertyIndex + 1];
654 654
655 655
656 // FIXME: At some point we need to fix this code to avoid return ing an invalid shorthand, 656 // FIXME: At some point we need to fix this code to avoid return ing an invalid shorthand,
657 // since some longhand combinations are not serializable into a single shorthand. 657 // since some longhand combinations are not serializable into a single shorthand.
658 if (!value->isPrimitiveValue() || !yValue->isPrimitiveValue()) 658 if (!value->isPrimitiveValue() || !yValue->isPrimitiveValue())
659 continue; 659 continue;
660 660
661 CSSValueID xId = toCSSPrimitiveValue(value)->getValueID(); 661 CSSValueID xId = toCSSPrimitiveValue(*value).getValueID();
662 CSSValueID yId = toCSSPrimitiveValue(yValue)->getValueID(); 662 CSSValueID yId = toCSSPrimitiveValue(*yValue).getValueID();
663 // Maybe advance propertyIndex to look at the next CSSValue in t he list for the checks below. 663 // Maybe advance propertyIndex to look at the next CSSValue in t he list for the checks below.
664 if (xId == yId) { 664 if (xId == yId) {
665 useSingleWordShorthand = true; 665 useSingleWordShorthand = true;
666 property = shorthand.properties()[++propertyIndex]; 666 property = shorthand.properties()[++propertyIndex];
667 } else if (xId == CSSValueRepeat && yId == CSSValueNoRepeat) { 667 } else if (xId == CSSValueRepeat && yId == CSSValueNoRepeat) {
668 useRepeatXShorthand = true; 668 useRepeatXShorthand = true;
669 property = shorthand.properties()[++propertyIndex]; 669 property = shorthand.properties()[++propertyIndex];
670 } else if (xId == CSSValueNoRepeat && yId == CSSValueRepeat) { 670 } else if (xId == CSSValueNoRepeat && yId == CSSValueRepeat) {
671 useRepeatYShorthand = true; 671 useRepeatYShorthand = true;
672 property = shorthand.properties()[++propertyIndex]; 672 property = shorthand.properties()[++propertyIndex];
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 result.append(value); 796 result.append(value);
797 } 797 }
798 if (isInitialOrInherit(commonValue)) 798 if (isInitialOrInherit(commonValue))
799 return commonValue; 799 return commonValue;
800 return result.isEmpty() ? String() : result.toString(); 800 return result.isEmpty() ? String() : result.toString();
801 } 801 }
802 802
803 static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue& repeatXCSSValue, const CSSValue& repeatYCSSValue) 803 static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue& repeatXCSSValue, const CSSValue& repeatYCSSValue)
804 { 804 {
805 // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS. 805 // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS.
806 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, initialRepeatValue, (CSSPrimitiveValue::create(CSSValueRepeat))); 806 CSSPrimitiveValue initialRepeatValue = CSSPrimitiveValue::create(CSSValueRep eat);
807 const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? *initi alRepeatValue : toCSSPrimitiveValue(repeatXCSSValue); 807 const CSSPrimitiveValue repeatX = repeatXCSSValue.isInitialValue() ? initial RepeatValue : toCSSPrimitiveValue(repeatXCSSValue);
808 const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? *initi alRepeatValue : toCSSPrimitiveValue(repeatYCSSValue); 808 const CSSPrimitiveValue repeatY = repeatYCSSValue.isInitialValue() ? initial RepeatValue : toCSSPrimitiveValue(repeatYCSSValue);
809 CSSValueID repeatXValueId = repeatX.getValueID(); 809 CSSValueID repeatXValueId = repeatX.getValueID();
810 CSSValueID repeatYValueId = repeatY.getValueID(); 810 CSSValueID repeatYValueId = repeatY.getValueID();
811 if (repeatXValueId == repeatYValueId) { 811 if (repeatXValueId == repeatYValueId) {
812 builder.append(repeatX.cssText()); 812 builder.append(repeatX.cssText());
813 } else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueR epeat) { 813 } else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueR epeat) {
814 builder.appendLiteral("repeat-y"); 814 builder.appendLiteral("repeat-y");
815 } else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoR epeat) { 815 } else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoR epeat) {
816 builder.appendLiteral("repeat-x"); 816 builder.appendLiteral("repeat-x");
817 } else { 817 } else {
818 builder.append(repeatX.cssText()); 818 builder.append(repeatX.cssText());
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 isInitialValue = false; 961 isInitialValue = false;
962 if (!value->isInheritedValue()) 962 if (!value->isInheritedValue())
963 isInheritedValue = false; 963 isInheritedValue = false;
964 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i])) 964 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i]))
965 return false; 965 return false;
966 } 966 }
967 return isInitialValue || isInheritedValue; 967 return isInitialValue || isInheritedValue;
968 } 968 }
969 969
970 } 970 }
OLDNEW
« no previous file with comments | « Source/core/css/RuleFeature.cpp ('k') | Source/core/css/StylePropertySet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698