| Index: Source/core/css/CSSValue.h
|
| diff --git a/Source/core/css/CSSValue.h b/Source/core/css/CSSValue.h
|
| index f5f7bac0274d156da50b3e5806bf0f8a82b157b5..cc6daebdb1d5b856b8fbc996b75911c397566f0f 100644
|
| --- a/Source/core/css/CSSValue.h
|
| +++ b/Source/core/css/CSSValue.h
|
| @@ -31,6 +31,12 @@
|
|
|
| namespace blink {
|
|
|
| +#if ENABLE(OILPAN) && USE_4BYTE_HEADER_PADDING
|
| +#define BIT_FIELD reinterpret_cast<HeapObjectHeader*>(reinterpret_cast<uint8_t*>(static_cast<CSSValue*>(const_cast<CSSValue*>(this))) - sizeof(HeapObjectHeader))->m_padding
|
| +#else
|
| +#define BIT_FIELD m_bitField
|
| +#endif
|
| +
|
| class CORE_EXPORT CSSValue : public RefCountedWillBeGarbageCollectedFinalized<CSSValue> {
|
| public:
|
| #if ENABLE(OILPAN)
|
| @@ -39,7 +45,9 @@ public:
|
| GC_PLUGIN_IGNORE("crbug.com/443854")
|
| void* operator new(size_t size)
|
| {
|
| - return allocateObject(size, false);
|
| + void* result = allocateObject(size, false);
|
| + // fprintf(stderr, "%p %ld\n", result, size);
|
| + return result;
|
| }
|
| static void* allocateObject(size_t size, bool isEager)
|
| {
|
| @@ -58,41 +66,41 @@ public:
|
|
|
| String cssText() const;
|
|
|
| - bool isPrimitiveValue() const { return m_classType == PrimitiveClass; }
|
| - bool isValueList() const { return m_classType >= ValueListClass; }
|
| -
|
| - bool isBaseValueList() const { return m_classType == ValueListClass; }
|
| -
|
| - bool isBorderImageSliceValue() const { return m_classType == BorderImageSliceClass; }
|
| - bool isCanvasValue() const { return m_classType == CanvasClass; }
|
| - bool isCounterValue() const { return m_classType == CounterClass; }
|
| - bool isCursorImageValue() const { return m_classType == CursorImageClass; }
|
| - bool isCrossfadeValue() const { return m_classType == CrossfadeClass; }
|
| - bool isFontFeatureValue() const { return m_classType == FontFeatureClass; }
|
| - bool isFontFaceSrcValue() const { return m_classType == FontFaceSrcClass; }
|
| - bool isFunctionValue() const { return m_classType == FunctionClass; }
|
| - bool isImageGeneratorValue() const { return m_classType >= CanvasClass && m_classType <= RadialGradientClass; }
|
| - bool isGradientValue() const { return m_classType >= LinearGradientClass && m_classType <= RadialGradientClass; }
|
| - bool isImageSetValue() const { return m_classType == ImageSetClass; }
|
| - bool isImageValue() const { return m_classType == ImageClass; }
|
| + bool isPrimitiveValue() const { return classType() == PrimitiveClass; }
|
| + bool isValueList() const { return classType() >= ValueListClass; }
|
| +
|
| + bool isBaseValueList() const { return classType() == ValueListClass; }
|
| +
|
| + bool isBorderImageSliceValue() const { return classType() == BorderImageSliceClass; }
|
| + bool isCanvasValue() const { return classType() == CanvasClass; }
|
| + bool isCounterValue() const { return classType() == CounterClass; }
|
| + bool isCursorImageValue() const { return classType() == CursorImageClass; }
|
| + bool isCrossfadeValue() const { return classType() == CrossfadeClass; }
|
| + bool isFontFeatureValue() const { return classType() == FontFeatureClass; }
|
| + bool isFontFaceSrcValue() const { return classType() == FontFaceSrcClass; }
|
| + bool isFunctionValue() const { return classType() == FunctionClass; }
|
| + bool isImageGeneratorValue() const { return classType() >= CanvasClass && classType() <= RadialGradientClass; }
|
| + bool isGradientValue() const { return classType() >= LinearGradientClass && classType() <= RadialGradientClass; }
|
| + bool isImageSetValue() const { return classType() == ImageSetClass; }
|
| + bool isImageValue() const { return classType() == ImageClass; }
|
| bool isImplicitInitialValue() const;
|
| - bool isInheritedValue() const { return m_classType == InheritedClass; }
|
| - bool isInitialValue() const { return m_classType == InitialClass; }
|
| - bool isUnsetValue() const { return m_classType == UnsetClass; }
|
| - bool isCSSWideKeyword() const { return m_classType >= InheritedClass && m_classType <= UnsetClass; }
|
| - bool isLinearGradientValue() const { return m_classType == LinearGradientClass; }
|
| - bool isPathValue() const { return m_classType == PathClass; }
|
| - bool isRadialGradientValue() const { return m_classType == RadialGradientClass; }
|
| - bool isReflectValue() const { return m_classType == ReflectClass; }
|
| - bool isShadowValue() const { return m_classType == ShadowClass; }
|
| - bool isCubicBezierTimingFunctionValue() const { return m_classType == CubicBezierTimingFunctionClass; }
|
| - bool isStepsTimingFunctionValue() const { return m_classType == StepsTimingFunctionClass; }
|
| - bool isLineBoxContainValue() const { return m_classType == LineBoxContainClass; }
|
| - bool isGridTemplateAreasValue() const { return m_classType == GridTemplateAreasClass; }
|
| - bool isSVGDocumentValue() const { return m_classType == CSSSVGDocumentClass; }
|
| - bool isContentDistributionValue() const { return m_classType == CSSContentDistributionClass; }
|
| - bool isUnicodeRangeValue() const { return m_classType == UnicodeRangeClass; }
|
| - bool isGridLineNamesValue() const { return m_classType == GridLineNamesClass; }
|
| + bool isInheritedValue() const { return classType() == InheritedClass; }
|
| + bool isInitialValue() const { return classType() == InitialClass; }
|
| + bool isUnsetValue() const { return classType() == UnsetClass; }
|
| + bool isCSSWideKeyword() const { return classType() >= InheritedClass && classType() <= UnsetClass; }
|
| + bool isLinearGradientValue() const { return classType() == LinearGradientClass; }
|
| + bool isPathValue() const { return classType() == PathClass; }
|
| + bool isRadialGradientValue() const { return classType() == RadialGradientClass; }
|
| + bool isReflectValue() const { return classType() == ReflectClass; }
|
| + bool isShadowValue() const { return classType() == ShadowClass; }
|
| + bool isCubicBezierTimingFunctionValue() const { return classType() == CubicBezierTimingFunctionClass; }
|
| + bool isStepsTimingFunctionValue() const { return classType() == StepsTimingFunctionClass; }
|
| + bool isLineBoxContainValue() const { return classType() == LineBoxContainClass; }
|
| + bool isGridTemplateAreasValue() const { return classType() == GridTemplateAreasClass; }
|
| + bool isSVGDocumentValue() const { return classType() == CSSSVGDocumentClass; }
|
| + bool isContentDistributionValue() const { return classType() == CSSContentDistributionClass; }
|
| + bool isUnicodeRangeValue() const { return classType() == UnicodeRangeClass; }
|
| + bool isGridLineNamesValue() const { return classType() == GridLineNamesClass; }
|
|
|
| bool hasFailedOrCanceledSubresources() const;
|
|
|
| @@ -165,36 +173,59 @@ protected:
|
| SlashSeparator
|
| };
|
|
|
| - ClassType classType() const { return static_cast<ClassType>(m_classType); }
|
| -
|
| explicit CSSValue(ClassType classType)
|
| - : m_primitiveUnitType(0)
|
| - , m_hasCachedCSSText(false)
|
| - , m_isQuirkValue(false)
|
| - , m_valueListSeparator(SpaceSeparator)
|
| - , m_classType(classType)
|
| {
|
| + setClassType(classType);
|
| + setValueListSeparator(SpaceSeparator);
|
| + setHasCachedCSSText(false);
|
| + setPrimitiveUnitType(0);
|
| + setIsQuirkValue(false);
|
| }
|
|
|
| // NOTE: This class is non-virtual for memory and performance reasons.
|
| // Don't go making it virtual again unless you know exactly what you're doing!
|
|
|
| +public:
|
| + unsigned primitiveUnitType() const { return getBitField(10, 7); }
|
| + void setPrimitiveUnitType(unsigned value) { setBitField(10, 7, value); }
|
| + bool isQuirkValue() const { return getBitField(9, 1); }
|
| + void setIsQuirkValue(bool value) { setBitField(9, 1, value); }
|
| + bool hasCachedCSSText() const { return getBitField(8, 1); }
|
| + void setHasCachedCSSText(bool value) { setBitField(8, 1, value); }
|
| + unsigned valueListSeparator() const { return getBitField(6, 2); }
|
| + void setValueListSeparator(unsigned value) { setBitField(6, 2, value); }
|
| + ClassType classType() const { return static_cast<ClassType>(getBitField(0, 6)); }
|
| + void setClassType(ClassType value) { setBitField(0, 6, value); }
|
| +
|
| private:
|
| + unsigned getBitField(unsigned offset, unsigned length) const
|
| + {
|
| + return (BIT_FIELD >> offset) & ((1 << length) - 1);
|
| + }
|
| + void setBitField(unsigned offset, unsigned length, unsigned value)
|
| + {
|
| + unsigned lower = getBitField(0, offset);
|
| + unsigned higher = getBitField(length + offset, 32 - length - offset);
|
| + BIT_FIELD = (higher << (length + offset)) | (value << offset) | lower;
|
| + }
|
| +
|
| void destroy();
|
|
|
| -protected:
|
| // The bits in this section are only used by specific subclasses but kept here
|
| // to maximize struct packing.
|
|
|
| +#if !(ENABLE(OILPAN) && USE_4BYTE_HEADER_PADDING)
|
| // CSSPrimitiveValue bits:
|
| + unsigned m_bitField;
|
| +#endif
|
| +
|
| + /*
|
| unsigned m_primitiveUnitType : 7; // CSSPrimitiveValue::UnitType
|
| - mutable unsigned m_hasCachedCSSText : 1;
|
| + unsigned m_hasCachedCSSText : 1;
|
| unsigned m_isQuirkValue : 1;
|
| -
|
| - unsigned m_valueListSeparator : ValueListSeparatorBits;
|
| -
|
| -private:
|
| - unsigned m_classType : ClassTypeBits; // ClassType
|
| + unsigned m_valueListSeparator : 2;
|
| + unsigned m_classType : 6; // ClassType
|
| + */
|
| };
|
|
|
| template<typename CSSValueType, size_t inlineCapacity>
|
|
|