/* * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "CSSStyleApplyProperty.h" #include "CSSAspectRatioValue.h" #include "CSSCursorImageValue.h" #include "CSSFlexValue.h" #include "CSSPrimitiveValueMappings.h" #include "CSSStyleSelector.h" #include "CSSValueList.h" #include "CursorList.h" #include "Document.h" #include "Element.h" #include "Pair.h" #include "Rect.h" #include "RenderObject.h" #include "RenderStyle.h" #include "Settings.h" #include #include using namespace std; namespace WebCore { enum ExpandValueBehavior {SuppressValue = 0, ExpandValue}; template class ApplyPropertyExpanding { public: template static inline void applyInheritValue(CSSStyleSelector* selector) { if (id == CSSPropertyInvalid) return; const CSSStyleApplyProperty& table = CSSStyleApplyProperty::sharedCSSStyleApplyProperty(); const PropertyHandler& handler = table.propertyHandler(id); if (handler.isValid()) handler.applyInheritValue(selector); } static void applyInheritValue(CSSStyleSelector* selector) { applyInheritValue(selector); applyInheritValue(selector); applyInheritValue(selector); applyInheritValue(selector); applyInheritValue(selector); } template static inline void applyInitialValue(CSSStyleSelector* selector) { if (id == CSSPropertyInvalid) return; const CSSStyleApplyProperty& table = CSSStyleApplyProperty::sharedCSSStyleApplyProperty(); const PropertyHandler& handler = table.propertyHandler(id); if (handler.isValid()) handler.applyInitialValue(selector); } static void applyInitialValue(CSSStyleSelector* selector) { applyInitialValue(selector); applyInitialValue(selector); applyInitialValue(selector); applyInitialValue(selector); applyInitialValue(selector); } template static inline void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (id == CSSPropertyInvalid) return; const CSSStyleApplyProperty& table = CSSStyleApplyProperty::sharedCSSStyleApplyProperty(); const PropertyHandler& handler = table.propertyHandler(id); if (handler.isValid()) handler.applyValue(selector, value); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!expandValue) return; applyValue(selector, value); applyValue(selector, value); applyValue(selector, value); applyValue(selector, value); applyValue(selector, value); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; template class ApplyPropertyDefaultBase { public: static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); } static GetterType value(RenderStyle* style) { return (style->*getterFunction)(); } static InitialType initial() { return (*initialFunction)(); } static void applyInheritValue(CSSStyleSelector* selector) { setValue(selector->style(), value(selector->parentStyle())); } static void applyInitialValue(CSSStyleSelector* selector) { setValue(selector->style(), initial()); } static void applyValue(CSSStyleSelector*, CSSValue*) { } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; template class ApplyPropertyDefault { public: static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (value->isPrimitiveValue()) setValue(selector->style(), *static_cast(value)); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; template class ApplyPropertyNumber { public: static void setValue(RenderStyle* style, NumberType value) { (style->*setterFunction)(value); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); if (primitiveValue->getIdent() == idMapsToMinusOne) setValue(selector->style(), -1); else setValue(selector->style(), primitiveValue->getValue(CSSPrimitiveValue::CSS_NUMBER)); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; template ), StyleImage* (*initialFunction)(), CSSPropertyID property> class ApplyPropertyStyleImage { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { (selector->style()->*setterFunction)(selector->styleImage(property, value)); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase, setterFunction, StyleImage*, initialFunction>::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; enum AutoValueType {Number = 0, ComputeLength}; template class ApplyPropertyAuto { public: static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); } static T value(RenderStyle* style) { return (style->*getterFunction)(); } static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)(); } static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); } static void applyInheritValue(CSSStyleSelector* selector) { if (hasAuto(selector->parentStyle())) setAuto(selector->style()); else setValue(selector->style(), value(selector->parentStyle())); } static void applyInitialValue(CSSStyleSelector* selector) { setAuto(selector->style()); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); if (primitiveValue->getIdent() == autoIdentity) setAuto(selector->style()); else if (valueType == Number) setValue(selector->style(), *primitiveValue); else if (valueType == ComputeLength) setValue(selector->style(), primitiveValue->computeLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom())); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyClip { private: static Length convertToLength(CSSStyleSelector* selector, CSSPrimitiveValue* value) { return value->convertToLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()); } public: static void applyInheritValue(CSSStyleSelector* selector) { RenderStyle* parentStyle = selector->parentStyle(); if (!parentStyle->hasClip()) return applyInitialValue(selector); selector->style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft()); selector->style()->setHasClip(true); } static void applyInitialValue(CSSStyleSelector* selector) { selector->style()->setClip(Length(), Length(), Length(), Length()); selector->style()->setHasClip(false); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); if (Rect* rect = primitiveValue->getRectValue()) { Length top = convertToLength(selector, rect->top()); Length right = convertToLength(selector, rect->right()); Length bottom = convertToLength(selector, rect->bottom()); Length left = convertToLength(selector, rect->left()); selector->style()->setClip(top, right, bottom, left); selector->style()->setHasClip(true); } else if (primitiveValue->getIdent() == CSSValueAuto) { selector->style()->setClip(Length(), Length(), Length(), Length()); selector->style()->setHasClip(true); } } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; enum ColorInherit {NoInheritFromParent = 0, InheritFromParent}; Color defaultInitialColor(); Color defaultInitialColor() { return Color(); } template class ApplyPropertyColor { public: static void applyInheritValue(CSSStyleSelector* selector) { // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed. const Color& color = (selector->parentStyle()->*getterFunction)(); applyColorValue(selector, color.isValid() ? color : (selector->parentStyle()->*defaultFunction)()); } static void applyInitialValue(CSSStyleSelector* selector) { applyColorValue(selector, initialFunction()); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor) applyInheritValue(selector); else { if (selector->applyPropertyToRegularStyle()) (selector->style()->*setterFunction)(selector->colorFromPrimitiveValue(primitiveValue)); if (selector->applyPropertyToVisitedLinkStyle()) (selector->style()->*visitedLinkSetterFunction)(selector->colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true)); } } static void applyColorValue(CSSStyleSelector* selector, const Color& color) { if (selector->applyPropertyToRegularStyle()) (selector->style()->*setterFunction)(color); if (selector->applyPropertyToVisitedLinkStyle()) (selector->style()->*visitedLinkSetterFunction)(color); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; template class ApplyPropertyDirection { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { ApplyPropertyDefault::applyValue(selector, value); Element* element = selector->element(); if (element && selector->element() == element->document()->documentElement()) element->document()->setDirectionSetOnDocumentElement(true); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefault::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; enum LengthAuto { AutoDisabled = 0, AutoEnabled }; enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled }; enum LengthMinIntrinsic { MinIntrinsicDisabled = 0, MinIntrinsicEnabled }; enum LengthNone { NoneDisabled = 0, NoneEnabled }; enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled }; enum LengthFlexDirection { FlexDirectionDisabled = 0, FlexWidth, FlexHeight }; template class ApplyPropertyLength { public: static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { float positiveFlex = 0; float negativeFlex = 0; if (!value->isPrimitiveValue()) { if (!flexDirection || !value->isFlexValue()) return; CSSFlexValue* flexValue = static_cast(value); value = flexValue->preferredSize(); positiveFlex = flexValue->positiveFlex(); negativeFlex = flexValue->negativeFlex(); } if (flexDirection == FlexWidth) { selector->style()->setFlexboxWidthPositiveFlex(positiveFlex); selector->style()->setFlexboxWidthNegativeFlex(negativeFlex); } else if (flexDirection == FlexHeight) { selector->style()->setFlexboxHeightPositiveFlex(positiveFlex); selector->style()->setFlexboxHeightNegativeFlex(negativeFlex); } CSSPrimitiveValue* primitiveValue = static_cast(value); if (noneEnabled && primitiveValue->getIdent() == CSSValueNone) if (noneUndefined) setValue(selector->style(), Length(Undefined)); else setValue(selector->style(), Length()); else if (intrinsicEnabled && primitiveValue->getIdent() == CSSValueIntrinsic) setValue(selector->style(), Length(Intrinsic)); else if (minIntrinsicEnabled && primitiveValue->getIdent() == CSSValueMinIntrinsic) setValue(selector->style(), Length(MinIntrinsic)); else if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto) setValue(selector->style(), Length()); else { if (primitiveValue->isLength()) { Length length = primitiveValue->computeLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()); length.setQuirk(primitiveValue->isQuirkValue()); setValue(selector->style(), length); } else if (primitiveValue->isPercentage()) setValue(selector->style(), Length(primitiveValue->getDoubleValue(), Percent)); } } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull }; template class ApplyPropertyString { public: static void setValue(RenderStyle* style, const AtomicString& value) { (style->*setterFunction)(value); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSSValueNone) || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto)) setValue(selector->style(), nullAtom); else setValue(selector->style(), primitiveValue->getStringValue()); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; template class ApplyPropertyBorderRadius { public: static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(value); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); Pair* pair = primitiveValue->getPairValue(); if (!pair || !pair->first() || !pair->second()) return; Length radiusWidth; Length radiusHeight; if (pair->first()->isPercentage()) radiusWidth = Length(pair->first()->getDoubleValue(), Percent); else if (pair->first()->isCalculatedPercentageWithLength()) { // FIXME calc(): http://webkit.org/b/16662 // handle this case return; } else radiusWidth = Length(max(intMinForLength, min(intMaxForLength, pair->first()->computeLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed); if (pair->second()->isPercentage()) radiusHeight = Length(pair->second()->getDoubleValue(), Percent); else if (pair->second()->isCalculatedPercentageWithLength()) { // FIXME calc(): http://webkit.org/b/16662 // handle this case return; } else radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed); int width = radiusWidth.value(); int height = radiusHeight.value(); if (width < 0 || height < 0) return; if (!width) radiusHeight = radiusWidth; // Null out the other value. else if (!height) radiusWidth = radiusHeight; // Null out the other value. LengthSize size(radiusWidth, radiusHeight); setValue(selector->style(), size); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; template struct FillLayerAccessorTypes { typedef T Setter; typedef T Getter; }; template <> struct FillLayerAccessorTypes { typedef PassRefPtr Setter; typedef StyleImage* Getter; }; template ::Getter (FillLayer::*getFunction)() const, void (FillLayer::*setFunction)(typename FillLayerAccessorTypes::Setter), void (FillLayer::*clearFunction)(), typename FillLayerAccessorTypes::Getter (*initialFunction)(EFillLayerType), void (CSSStyleSelector::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)> class ApplyPropertyFillLayer { public: static void applyInheritValue(CSSStyleSelector* selector) { FillLayer* currChild = (selector->style()->*accessLayersFunction)(); FillLayer* prevChild = 0; const FillLayer* currParent = (selector->parentStyle()->*layersFunction)(); while (currParent && (currParent->*testFunction)()) { if (!currChild) { /* Need to make a new layer.*/ currChild = new FillLayer(fillLayerType); prevChild->setNext(currChild); } (currChild->*setFunction)((currParent->*getFunction)()); prevChild = currChild; currChild = prevChild->next(); currParent = currParent->next(); } while (currChild) { /* Reset any remaining layers to not have the property set. */ (currChild->*clearFunction)(); currChild = currChild->next(); } } static void applyInitialValue(CSSStyleSelector* selector) { FillLayer* currChild = (selector->style()->*accessLayersFunction)(); (currChild->*setFunction)((*initialFunction)(fillLayerType)); for (currChild = currChild->next(); currChild; currChild = currChild->next()) (currChild->*clearFunction)(); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { FillLayer* currChild = (selector->style()->*accessLayersFunction)(); FillLayer* prevChild = 0; if (value->isValueList()) { /* Walk each value and put it into a layer, creating new layers as needed. */ CSSValueList* valueList = static_cast(value); for (unsigned int i = 0; i < valueList->length(); i++) { if (!currChild) { /* Need to make a new layer to hold this value */ currChild = new FillLayer(fillLayerType); prevChild->setNext(currChild); } (selector->*mapFillFunction)(propertyId, currChild, valueList->itemWithoutBoundsCheck(i)); prevChild = currChild; currChild = currChild->next(); } } else { (selector->*mapFillFunction)(propertyId, currChild, value); currChild = currChild->next(); } while (currChild) { /* Reset all remaining layers to not have the property set. */ (currChild->*clearFunction)(); currChild = currChild->next(); } } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; enum ComputeLengthNormal {NormalDisabled = 0, NormalEnabled}; enum ComputeLengthThickness {ThicknessDisabled = 0, ThicknessEnabled}; enum ComputeLengthSVGZoom {SVGZoomDisabled = 0, SVGZoomEnabled}; template class ApplyPropertyComputeLength { public: static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason... if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); int ident = primitiveValue->getIdent(); T length; if (normalEnabled && ident == CSSValueNormal) { length = 0; } else if (thicknessEnabled && ident == CSSValueThin) { length = 1; } else if (thicknessEnabled && ident == CSSValueMedium) { length = 3; } else if (thicknessEnabled && ident == CSSValueThick) { length = 5; } else if (ident == CSSValueInvalid) { float zoom = (svgZoomEnabled && selector->useSVGZoomRules()) ? 1.0f : selector->style()->effectiveZoom(); length = primitiveValue->computeLength(selector->style(), selector->rootElementStyle(), zoom); } else { ASSERT_NOT_REACHED(); length = 0; } setValue(selector->style(), length); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; template class ApplyPropertyFont { public: static void applyInheritValue(CSSStyleSelector* selector) { FontDescription fontDescription = selector->fontDescription(); (fontDescription.*setterFunction)((selector->parentFontDescription().*getterFunction)()); selector->setFontDescription(fontDescription); } static void applyInitialValue(CSSStyleSelector* selector) { FontDescription fontDescription = selector->fontDescription(); (fontDescription.*setterFunction)(initialValue); selector->setFontDescription(fontDescription); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); FontDescription fontDescription = selector->fontDescription(); (fontDescription.*setterFunction)(*primitiveValue); selector->setFontDescription(fontDescription); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyFontSize { private: // When the CSS keyword "larger" is used, this function will attempt to match within the keyword // table, and failing that, will simply multiply by 1.2. static float largerFontSize(float size) { // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to // the next size level. return size * 1.2f; } // Like the previous function, but for the keyword "smaller". static float smallerFontSize(float size) { // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to // the next size level. return size / 1.2f; } public: static void applyInheritValue(CSSStyleSelector* selector) { float size = selector->parentStyle()->fontDescription().specifiedSize(); if (size < 0) return; FontDescription fontDescription = selector->style()->fontDescription(); fontDescription.setKeywordSize(selector->parentStyle()->fontDescription().keywordSize()); selector->setFontSize(fontDescription, size); selector->setFontDescription(fontDescription); return; } static void applyInitialValue(CSSStyleSelector* selector) { FontDescription fontDescription = selector->style()->fontDescription(); float size = selector->fontSizeForKeyword(selector->document(), CSSValueMedium, fontDescription.useFixedDefaultSize()); if (size < 0) return; fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); selector->setFontSize(fontDescription, size); selector->setFontDescription(fontDescription); return; } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); FontDescription fontDescription = selector->style()->fontDescription(); fontDescription.setKeywordSize(0); float parentSize = 0; bool parentIsAbsoluteSize = false; float size = 0; if (selector->hasParentNode()) { parentSize = selector->parentStyle()->fontDescription().specifiedSize(); parentIsAbsoluteSize = selector->parentStyle()->fontDescription().isAbsoluteSize(); } if (int ident = primitiveValue->getIdent()) { // Keywords are being used. switch (ident) { case CSSValueXxSmall: case CSSValueXSmall: case CSSValueSmall: case CSSValueMedium: case CSSValueLarge: case CSSValueXLarge: case CSSValueXxLarge: case CSSValueWebkitXxxLarge: size = selector->fontSizeForKeyword(selector->document(), ident, fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(ident - CSSValueXxSmall + 1); break; case CSSValueLarger: size = largerFontSize(parentSize); break; case CSSValueSmaller: size = smallerFontSize(parentSize); break; default: return; } fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (ident == CSSValueLarger || ident == CSSValueSmaller)); } else { fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength())); if (primitiveValue->isLength()) size = primitiveValue->computeLength(selector->parentStyle(), selector->rootElementStyle(), 1.0, true); else if (primitiveValue->isPercentage()) size = (primitiveValue->getFloatValue() * parentSize) / 100.0f; else return; } if (size < 0) return; selector->setFontSize(fontDescription, size); selector->setFontDescription(fontDescription); return; } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyFontWeight { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); FontDescription fontDescription = selector->fontDescription(); switch (primitiveValue->getIdent()) { case CSSValueInvalid: ASSERT_NOT_REACHED(); break; case CSSValueBolder: fontDescription.setWeight(fontDescription.bolderWeight()); break; case CSSValueLighter: fontDescription.setWeight(fontDescription.lighterWeight()); break; default: fontDescription.setWeight(*primitiveValue); } selector->setFontDescription(fontDescription); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyFont::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; class ApplyPropertyFontVariantLigatures { public: static void applyInheritValue(CSSStyleSelector* selector) { const FontDescription& parentFontDescription = selector->parentFontDescription(); FontDescription fontDescription = selector->fontDescription(); fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState()); fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState()); fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState()); selector->setFontDescription(fontDescription); } static void applyInitialValue(CSSStyleSelector* selector) { FontDescription fontDescription = selector->fontDescription(); fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState); fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState); fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState); selector->setFontDescription(fontDescription); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState; FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState; FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState; if (value->isValueList()) { CSSValueList* valueList = static_cast(value); for (size_t i = 0; i < valueList->length(); ++i) { CSSValue* item = valueList->itemWithoutBoundsCheck(i); ASSERT(item->isPrimitiveValue()); if (item->isPrimitiveValue()) { CSSPrimitiveValue* primitiveValue = static_cast(item); switch (primitiveValue->getIdent()) { case CSSValueNoCommonLigatures: commonLigaturesState = FontDescription::DisabledLigaturesState; break; case CSSValueCommonLigatures: commonLigaturesState = FontDescription::EnabledLigaturesState; break; case CSSValueNoDiscretionaryLigatures: discretionaryLigaturesState = FontDescription::DisabledLigaturesState; break; case CSSValueDiscretionaryLigatures: discretionaryLigaturesState = FontDescription::EnabledLigaturesState; break; case CSSValueNoHistoricalLigatures: historicalLigaturesState = FontDescription::DisabledLigaturesState; break; case CSSValueHistoricalLigatures: historicalLigaturesState = FontDescription::EnabledLigaturesState; break; default: ASSERT_NOT_REACHED(); break; } } } } #if !ASSERT_DISABLED else { ASSERT(value->isPrimitiveValue()); ASSERT(static_cast(value)->getIdent() == CSSValueNormal); } #endif FontDescription fontDescription = selector->fontDescription(); fontDescription.setCommonLigaturesState(commonLigaturesState); fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState); fontDescription.setHistoricalLigaturesState(historicalLigaturesState); selector->setFontDescription(fontDescription); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; enum BorderImageType { Image = 0, Mask }; template class ApplyPropertyBorderImage { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { NinePieceImage image; if (borderImageType == Mask) image.setMaskDefaults(); selector->mapNinePieceImage(property, value, image); (selector->style()->*setterFunction)(image); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; enum BorderImageModifierType { Outset, Repeat, Slice, Width }; template class ApplyPropertyBorderImageModifier { private: static inline const NinePieceImage& getValue(RenderStyle* style) { return type == Image ? style->borderImage() : style->maskBoxImage(); } static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == Image ? style->setBorderImage(value) : style->setMaskBoxImage(value); } public: static void applyInheritValue(CSSStyleSelector* selector) { NinePieceImage image(getValue(selector->style())); switch (modifier) { case Outset: image.copyOutsetFrom(getValue(selector->parentStyle())); break; case Repeat: image.copyRepeatFrom(getValue(selector->parentStyle())); break; case Slice: image.copyImageSlicesFrom(getValue(selector->parentStyle())); break; case Width: image.copyBorderSlicesFrom(getValue(selector->parentStyle())); break; } setValue(selector->style(), image); } static void applyInitialValue(CSSStyleSelector* selector) { NinePieceImage image(getValue(selector->style())); switch (modifier) { case Outset: image.setOutset(LengthBox(0)); break; case Repeat: image.setHorizontalRule(StretchImageRule); image.setVerticalRule(StretchImageRule); break; case Slice: // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility. image.setImageSlices(type == Image ? LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)) : LengthBox()); image.setFill(false); break; case Width: // Masks have a different initial value for widths. They use an 'auto' value rather than trying to fit to the border. image.setBorderSlices(type == Image ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox()); break; } setValue(selector->style(), image); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { NinePieceImage image(getValue(selector->style())); switch (modifier) { case Outset: image.setOutset(selector->mapNinePieceImageQuad(value)); break; case Repeat: selector->mapNinePieceImageRepeat(value, image); break; case Slice: selector->mapNinePieceImageSlice(value, image); break; case Width: image.setBorderSlices(selector->mapNinePieceImageQuad(value)); break; } setValue(selector->style(), image); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; template ), StyleImage* (*initialFunction)()> class ApplyPropertyBorderImageSource { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { (selector->style()->*setterFunction)(selector->styleImage(id, value)); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase, setterFunction, StyleImage*, initialFunction>::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; enum CounterBehavior {Increment = 0, Reset}; template class ApplyPropertyCounter { public: static void emptyFunction(CSSStyleSelector*) { } static void applyInheritValue(CSSStyleSelector* selector) { CounterDirectiveMap& map = selector->style()->accessCounterDirectives(); CounterDirectiveMap& parentMap = selector->parentStyle()->accessCounterDirectives(); typedef CounterDirectiveMap::iterator Iterator; Iterator end = parentMap.end(); for (Iterator it = parentMap.begin(); it != end; ++it) { CounterDirectives& directives = map.add(it->first, CounterDirectives()).first->second; if (counterBehavior == Reset) { directives.m_reset = it->second.m_reset; directives.m_resetValue = it->second.m_resetValue; } else { // Inheriting a counter-increment means taking the parent's current value for the counter // and adding it to itself. directives.m_increment = it->second.m_increment; directives.m_incrementValue = 0; if (directives.m_increment) { float incrementValue = directives.m_incrementValue; directives.m_incrementValue = clampToInteger(incrementValue + it->second.m_incrementValue); } else { directives.m_increment = true; directives.m_incrementValue = it->second.m_incrementValue; } } } } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isValueList()) return; CSSValueList* list = static_cast(value); CounterDirectiveMap& map = selector->style()->accessCounterDirectives(); typedef CounterDirectiveMap::iterator Iterator; Iterator end = map.end(); for (Iterator it = map.begin(); it != end; ++it) if (counterBehavior == Reset) it->second.m_reset = false; else it->second.m_increment = false; int length = list ? list->length() : 0; for (int i = 0; i < length; ++i) { CSSValue* currValue = list->itemWithoutBoundsCheck(i); if (!currValue->isPrimitiveValue()) continue; Pair* pair = static_cast(currValue)->getPairValue(); if (!pair || !pair->first() || !pair->second()) continue; AtomicString identifier = static_cast(pair->first())->getStringValue(); int value = static_cast(pair->second())->getIntValue(); CounterDirectives& directives = map.add(identifier.impl(), CounterDirectives()).first->second; if (counterBehavior == Reset) { directives.m_reset = true; directives.m_resetValue = value; } else { if (directives.m_increment) { float incrementValue = directives.m_incrementValue; directives.m_incrementValue = clampToInteger(incrementValue + value); } else { directives.m_increment = true; directives.m_incrementValue = value; } } } } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &emptyFunction, &applyValue); } }; class ApplyPropertyCursor { public: static void applyInheritValue(CSSStyleSelector* selector) { selector->style()->setCursor(selector->parentStyle()->cursor()); selector->style()->setCursorList(selector->parentStyle()->cursors()); } static void applyInitialValue(CSSStyleSelector* selector) { selector->style()->clearCursorList(); selector->style()->setCursor(RenderStyle::initialCursor()); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { selector->style()->clearCursorList(); if (value->isValueList()) { CSSValueList* list = static_cast(value); int len = list->length(); selector->style()->setCursor(CURSOR_AUTO); for (int i = 0; i < len; i++) { CSSValue* item = list->itemWithoutBoundsCheck(i); if (!item->isPrimitiveValue()) continue; CSSPrimitiveValue* primitiveValue = static_cast(item); if (primitiveValue->isURI()) { if (primitiveValue->isCursorImageValue()) { CSSCursorImageValue* image = static_cast(primitiveValue); if (image->updateIfSVGCursorIsUsed(selector->element())) // Elements with SVG cursors are not allowed to share style. selector->style()->setUnique(); selector->style()->addCursor(selector->cachedOrPendingFromValue(CSSPropertyCursor, image), image->hotSpot()); } } else if (primitiveValue->isIdent()) selector->style()->setCursor(*primitiveValue); } } else if (value->isPrimitiveValue()) { CSSPrimitiveValue* primitiveValue = static_cast(value); if (primitiveValue->isIdent() && selector->style()->cursor() != ECursor(*primitiveValue)) selector->style()->setCursor(*primitiveValue); } } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyTextAlign { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); if (primitiveValue->getIdent() != CSSValueWebkitMatchParent) selector->style()->setTextAlign(*primitiveValue); else if (selector->parentStyle()->textAlign() == TASTART) selector->style()->setTextAlign(selector->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT); else if (selector->parentStyle()->textAlign() == TAEND) selector->style()->setTextAlign(selector->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT); else selector->style()->setTextAlign(selector->parentStyle()->textAlign()); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; class ApplyPropertyTextDecoration { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { ETextDecoration t = RenderStyle::initialTextDecoration(); for (CSSValueListIterator i(value); i.hasMore(); i.advance()) { CSSValue* item = i.value(); ASSERT(item->isPrimitiveValue()); t |= *static_cast(item); } selector->style()->setTextDecoration(t); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; class ApplyPropertyLineHeight { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); Length lineHeight; if (primitiveValue->getIdent() == CSSValueNormal) lineHeight = Length(-100.0, Percent); else if (primitiveValue->isLength()) { double multiplier = selector->style()->effectiveZoom(); if (selector->style()->textSizeAdjust()) { if (Frame* frame = selector->document()->frame()) multiplier *= frame->textZoomFactor(); } lineHeight = primitiveValue->computeLength(selector->style(), selector->rootElementStyle(), multiplier); } else if (primitiveValue->isPercentage()) { // FIXME: percentage should not be restricted to an integer here. lineHeight = Length((selector->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed); } else if (primitiveValue->isNumber()) { // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent). lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent); } else return; selector->style()->setLineHeight(lineHeight); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; class ApplyPropertyPageSize { private: static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength(0, 0); } static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength(0, 0); } static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height) { static const Length a5Width = mmLength(148), a5Height = mmLength(210); static const Length a4Width = mmLength(210), a4Height = mmLength(297); static const Length a3Width = mmLength(297), a3Height = mmLength(420); static const Length b5Width = mmLength(176), b5Height = mmLength(250); static const Length b4Width = mmLength(250), b4Height = mmLength(353); static const Length letterWidth = inchLength(8.5), letterHeight = inchLength(11); static const Length legalWidth = inchLength(8.5), legalHeight = inchLength(14); static const Length ledgerWidth = inchLength(11), ledgerHeight = inchLength(17); if (!pageSizeName) return false; switch (pageSizeName->getIdent()) { case CSSValueA5: width = a5Width; height = a5Height; break; case CSSValueA4: width = a4Width; height = a4Height; break; case CSSValueA3: width = a3Width; height = a3Height; break; case CSSValueB5: width = b5Width; height = b5Height; break; case CSSValueB4: width = b4Width; height = b4Height; break; case CSSValueLetter: width = letterWidth; height = letterHeight; break; case CSSValueLegal: width = legalWidth; height = legalHeight; break; case CSSValueLedger: width = ledgerWidth; height = ledgerHeight; break; default: return false; } if (pageOrientation) { switch (pageOrientation->getIdent()) { case CSSValueLandscape: std::swap(width, height); break; case CSSValuePortrait: // Nothing to do. break; default: return false; } } return true; } public: static void applyInheritValue(CSSStyleSelector*) { } static void applyInitialValue(CSSStyleSelector*) { } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { selector->style()->resetPageSizeType(); Length width; Length height; PageSizeType pageSizeType = PAGE_SIZE_AUTO; CSSValueListInspector inspector(value); switch (inspector.length()) { case 2: { // {2} | if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue()) return; CSSPrimitiveValue* first = static_cast(inspector.first()); CSSPrimitiveValue* second = static_cast(inspector.second()); if (first->isLength()) { // {2} if (!second->isLength()) return; width = first->computeLength(selector->style(), selector->rootElementStyle()); height = second->computeLength(selector->style(), selector->rootElementStyle()); } else { // // The value order is guaranteed. See CSSParser::parseSizeParameter. if (!getPageSizeFromName(first, second, width, height)) return; } pageSizeType = PAGE_SIZE_RESOLVED; break; } case 1: { // | auto | | [ portrait | landscape] if (!inspector.first()->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(inspector.first()); if (primitiveValue->isLength()) { // pageSizeType = PAGE_SIZE_RESOLVED; width = height = primitiveValue->computeLength(selector->style(), selector->rootElementStyle()); } else { switch (primitiveValue->getIdent()) { case 0: return; case CSSValueAuto: pageSizeType = PAGE_SIZE_AUTO; break; case CSSValuePortrait: pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; break; case CSSValueLandscape: pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; break; default: // pageSizeType = PAGE_SIZE_RESOLVED; if (!getPageSizeFromName(primitiveValue, 0, width, height)) return; } } break; } default: return; } selector->style()->setPageSizeType(pageSizeType); selector->style()->setPageSize(LengthSize(width, height)); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyTextEmphasisStyle { public: static void applyInheritValue(CSSStyleSelector* selector) { selector->style()->setTextEmphasisFill(selector->parentStyle()->textEmphasisFill()); selector->style()->setTextEmphasisMark(selector->parentStyle()->textEmphasisMark()); selector->style()->setTextEmphasisCustomMark(selector->parentStyle()->textEmphasisCustomMark()); } static void applyInitialValue(CSSStyleSelector* selector) { selector->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill()); selector->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark()); selector->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark()); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (value->isValueList()) { CSSValueList* list = static_cast(value); ASSERT(list->length() == 2); if (list->length() != 2) return; for (unsigned i = 0; i < 2; ++i) { CSSValue* item = list->itemWithoutBoundsCheck(i); if (!item->isPrimitiveValue()) continue; CSSPrimitiveValue* value = static_cast(item); if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen) selector->style()->setTextEmphasisFill(*value); else selector->style()->setTextEmphasisMark(*value); } selector->style()->setTextEmphasisCustomMark(nullAtom); return; } if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); if (primitiveValue->isString()) { selector->style()->setTextEmphasisFill(TextEmphasisFillFilled); selector->style()->setTextEmphasisMark(TextEmphasisMarkCustom); selector->style()->setTextEmphasisCustomMark(primitiveValue->getStringValue()); return; } selector->style()->setTextEmphasisCustomMark(nullAtom); if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getIdent() == CSSValueOpen) { selector->style()->setTextEmphasisFill(*primitiveValue); selector->style()->setTextEmphasisMark(TextEmphasisMarkAuto); } else { selector->style()->setTextEmphasisFill(TextEmphasisFillFilled); selector->style()->setTextEmphasisMark(*primitiveValue); } } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; template class ApplyPropertyAnimation { public: static void setValue(Animation* animation, T value) { (animation->*setterFunction)(value); } static T value(const Animation* animation) { return (animation->*getterFunction)(); } static bool test(const Animation* animation) { return (animation->*testFunction)(); } static void clear(Animation* animation) { (animation->*clearFunction)(); } static T initial() { return (*initialFunction)(); } static void map(CSSStyleSelector* selector, Animation* animation, CSSValue* value) { (selector->*mapFunction)(animation, value); } static AnimationList* accessAnimations(RenderStyle* style) { return (style->*animationGetterFunction)(); } static const AnimationList* animations(RenderStyle* style) { return (style->*immutableAnimationGetterFunction)(); } static void applyInheritValue(CSSStyleSelector* selector) { AnimationList* list = accessAnimations(selector->style()); const AnimationList* parentList = animations(selector->parentStyle()); size_t i = 0, parentSize = parentList ? parentList->size() : 0; for ( ; i < parentSize && test(parentList->animation(i)); ++i) { if (list->size() <= i) list->append(Animation::create()); setValue(list->animation(i), value(parentList->animation(i))); } /* Reset any remaining animations to not have the property set. */ for ( ; i < list->size(); ++i) clear(list->animation(i)); } static void applyInitialValue(CSSStyleSelector* selector) { AnimationList* list = accessAnimations(selector->style()); if (list->isEmpty()) list->append(Animation::create()); setValue(list->animation(0), initial()); for (size_t i = 1; i < list->size(); ++i) clear(list->animation(i)); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { AnimationList* list = accessAnimations(selector->style()); size_t childIndex = 0; if (value->isValueList()) { /* Walk each value and put it into an animation, creating new animations as needed. */ for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { if (childIndex <= list->size()) list->append(Animation::create()); map(selector, list->animation(childIndex), i.value()); ++childIndex; } } else { if (list->isEmpty()) list->append(Animation::create()); map(selector, list->animation(childIndex), value); childIndex = 1; } for ( ; childIndex < list->size(); ++childIndex) { /* Reset all remaining animations to not have the property set. */ clear(list->animation(childIndex)); } } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyOutlineStyle { public: static void applyInheritValue(CSSStyleSelector* selector) { ApplyPropertyDefaultBase::applyInheritValue(selector); ApplyPropertyDefaultBase::applyInheritValue(selector); } static void applyInitialValue(CSSStyleSelector* selector) { ApplyPropertyDefaultBase::applyInitialValue(selector); ApplyPropertyDefaultBase::applyInitialValue(selector); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { ApplyPropertyDefault::applyValue(selector, value); ApplyPropertyDefault::applyValue(selector, value); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyResize { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); EResize r = RESIZE_NONE; switch (primitiveValue->getIdent()) { case 0: return; case CSSValueAuto: if (Settings* settings = selector->document()->settings()) r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE; break; default: r = *primitiveValue; } selector->style()->setResize(r); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; class ApplyPropertyVerticalAlign { public: static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast(value); if (primitiveValue->getIdent()) return selector->style()->setVerticalAlign(*primitiveValue); Length length; if (primitiveValue->isLength()) length = primitiveValue->computeLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()); else if (primitiveValue->isPercentage()) length = Length(primitiveValue->getDoubleValue(), Percent); selector->style()->setVerticalAlignLength(length); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; class ApplyPropertyAspectRatio { public: static void applyInheritValue(CSSStyleSelector* selector) { if (!selector->parentStyle()->hasAspectRatio()) return; selector->style()->setHasAspectRatio(true); selector->style()->setAspectRatioDenominator(selector->parentStyle()->aspectRatioDenominator()); selector->style()->setAspectRatioNumerator(selector->parentStyle()->aspectRatioNumerator()); } static void applyInitialValue(CSSStyleSelector* selector) { selector->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio()); selector->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator()); selector->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator()); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isAspectRatioValue()) { selector->style()->setHasAspectRatio(false); return; } CSSAspectRatioValue* aspectRatioValue = static_cast(value); selector->style()->setHasAspectRatio(true); selector->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue()); selector->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue()); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyZoom { private: static void resetEffectiveZoom(CSSStyleSelector* selector) { // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect. selector->setEffectiveZoom(selector->parentStyle() ? selector->parentStyle()->effectiveZoom() : RenderStyle::initialZoom()); } public: static void applyInheritValue(CSSStyleSelector* selector) { resetEffectiveZoom(selector); selector->setZoom(selector->parentStyle()->zoom()); } static void applyInitialValue(CSSStyleSelector* selector) { resetEffectiveZoom(selector); selector->setZoom(RenderStyle::initialZoom()); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { ASSERT(value->isPrimitiveValue()); CSSPrimitiveValue* primitiveValue = static_cast(value); if (primitiveValue->getIdent() == CSSValueNormal) { resetEffectiveZoom(selector); selector->setZoom(RenderStyle::initialZoom()); } else if (primitiveValue->getIdent() == CSSValueReset) { selector->setEffectiveZoom(RenderStyle::initialZoom()); selector->setZoom(RenderStyle::initialZoom()); } else if (primitiveValue->getIdent() == CSSValueDocument) { float docZoom = selector->document()->renderer()->style()->zoom(); selector->setEffectiveZoom(docZoom); selector->setZoom(docZoom); } else if (primitiveValue->isPercentage()) { resetEffectiveZoom(selector); if (float percent = primitiveValue->getFloatValue()) selector->setZoom(percent / 100.0f); } else if (primitiveValue->isNumber()) { resetEffectiveZoom(selector); if (float number = primitiveValue->getFloatValue()) selector->setZoom(number); } } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; class ApplyPropertyDisplay { private: static inline bool isValidDisplayValue(CSSStyleSelector* selector, EDisplay displayPropertyValue) { #if ENABLE(SVG) if (selector->element() && selector->element()->isSVGElement() && selector->style()->styleType() == NOPSEUDO) return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE); #else UNUSED_PARAM(selector); UNUSED_PARAM(displayPropertyValue); #endif return true; } public: static void applyInheritValue(CSSStyleSelector* selector) { EDisplay display = selector->parentStyle()->display(); if (!isValidDisplayValue(selector, display)) return; selector->style()->setDisplay(display); } static void applyInitialValue(CSSStyleSelector* selector) { selector->style()->setDisplay(RenderStyle::initialDisplay()); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { if (!value->isPrimitiveValue()) return; EDisplay display = *static_cast(value); if (!isValidDisplayValue(selector, display)) return; selector->style()->setDisplay(display); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty() { DEFINE_STATIC_LOCAL(CSSStyleApplyProperty, cssStyleApplyPropertyInstance, ()); return cssStyleApplyPropertyInstance; } CSSStyleApplyProperty::CSSStyleApplyProperty() { for (int i = 0; i < numCSSProperties; ++i) m_propertyMap[i] = PropertyHandler(); setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler()); setPropertyHandler(CSSPropertyColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler()); setPropertyHandler(CSSPropertyBackgroundAttachment, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyBackgroundClip, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip); setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler()); setPropertyHandler(CSSPropertyBackgroundImage, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyBackgroundOrigin, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin); setPropertyHandler(CSSPropertyBackgroundPositionX, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyBackgroundPositionY, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyBackgroundPosition, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBackgroundRepeatX, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyBackgroundRepeatY, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyBackgroundRepeat, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBackgroundSize, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize); setPropertyHandler(CSSPropertyWebkitMaskAttachment, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskOrigin, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskPositionX, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskPositionY, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskPosition, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskRepeatX, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskRepeat, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBackgroundColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyBorderCollapse, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyBorderBottomColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyBorderRightColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyBorderTopColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyBorderTopStyle, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyBorderRightStyle, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyBorderBottomStyle, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyBorderTop, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderRight, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderBottom, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderLeft, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderStyle, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderWidth, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderColor, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorder, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderImage, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage::createHandler()); setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyBorderImageSource, ApplyPropertyBorderImageSource::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageSource, ApplyPropertyBorderImageSource::createHandler()); setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler()); setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler()); setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler()); setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler()); setPropertyHandler(CSSPropertyBorderRadius, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitBorderRadius, CSSPropertyBorderRadius); setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyBorderSpacing, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyCaptionSide, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyClear, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyClip, ApplyPropertyClip::createHandler()); setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler()); setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter::createHandler()); setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter::createHandler()); setPropertyHandler(CSSPropertyEmptyCells, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexOrder, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexPack, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexAlign, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexItemAlign, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexFlow, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyFloat, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler()); setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont::createHandler()); setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont::createHandler()); setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont::createHandler()); setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont::createHandler()); setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont::createHandler()); setPropertyHandler(CSSPropertyWebkitTextOrientation, ApplyPropertyFont::createHandler()); setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler()); setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler()); setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler()); setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler()); setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler()); setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyOutline, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyOverflowX, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyOverflowY, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyOverflow, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnRuleColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler()); setPropertyHandler(CSSPropertyRight, ApplyPropertyLength<&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset, AutoEnabled>::createHandler()); setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler()); setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler()); setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>::createHandler()); setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>::createHandler()); setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyLength<&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent>::createHandler()); setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler()); setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler()); setPropertyHandler(CSSPropertyListStylePosition, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyListStyleType, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyListStyle, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyMaxHeight, ApplyPropertyLength<&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler()); setPropertyHandler(CSSPropertyMaxWidth, ApplyPropertyLength<&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler()); setPropertyHandler(CSSPropertyMinHeight, ApplyPropertyLength<&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>::createHandler()); setPropertyHandler(CSSPropertyMinWidth, ApplyPropertyLength<&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>::createHandler()); setPropertyHandler(CSSPropertyMarginTop, ApplyPropertyLength<&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin, AutoEnabled>::createHandler()); setPropertyHandler(CSSPropertyMarginRight, ApplyPropertyLength<&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin, AutoEnabled>::createHandler()); setPropertyHandler(CSSPropertyMarginBottom, ApplyPropertyLength<&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin, AutoEnabled>::createHandler()); setPropertyHandler(CSSPropertyMarginLeft, ApplyPropertyLength<&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin, AutoEnabled>::createHandler()); setPropertyHandler(CSSPropertyMargin, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitMarginBeforeCollapse, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitMarginAfterCollapse, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse); setPropertyHandler(CSSPropertyWebkitMarginBottomCollapse, CSSPropertyWebkitMarginAfterCollapse); setPropertyHandler(CSSPropertyWebkitMarginCollapse, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyPaddingTop, ApplyPropertyLength<&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding>::createHandler()); setPropertyHandler(CSSPropertyPaddingRight, ApplyPropertyLength<&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding>::createHandler()); setPropertyHandler(CSSPropertyPaddingBottom, ApplyPropertyLength<&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding>::createHandler()); setPropertyHandler(CSSPropertyPaddingLeft, ApplyPropertyLength<&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding>::createHandler()); setPropertyHandler(CSSPropertyPadding, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyPageBreakAfter, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyPageBreakBefore, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyPageBreakInside, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyPosition, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler()); setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler()); setPropertyHandler(CSSPropertyTableLayout, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyTextTransform, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler()); setPropertyHandler(CSSPropertyVisibility, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWhiteSpace, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWordBreak, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationDuration, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationFillMode, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationIterationCount, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSStyleSelector::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); setPropertyHandler(CSSPropertyWebkitAppearance, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBackfaceVisibility, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxAlign, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxDirection, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxFlex, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxFlexGroup, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxLines, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxOrdinalGroup, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxOrient, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxPack, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnCount, ApplyPropertyAuto::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnGap, ApplyPropertyAuto::createHandler()); setPropertyHandler(CSSPropertyWebkitColumns, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnSpan, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto::createHandler()); setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString::createHandler()); setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString::createHandler()); setPropertyHandler(CSSPropertyWebkitHighlight, ApplyPropertyString::createHandler()); setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, ApplyPropertyString::createHandler()); setPropertyHandler(CSSPropertyWebkitHyphenateLimitAfter, ApplyPropertyNumber::createHandler()); setPropertyHandler(CSSPropertyWebkitHyphenateLimitBefore, ApplyPropertyNumber::createHandler()); setPropertyHandler(CSSPropertyWebkitHyphenateLimitLines, ApplyPropertyNumber::createHandler()); setPropertyHandler(CSSPropertyWebkitLineAlign, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitLineBreak, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString::createHandler()); setPropertyHandler(CSSPropertyWebkitLineSnap, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitMarqueeDirection, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitMarqueeStyle, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitMatchNearestMailBlockquoteColor, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitNbspMode, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler()); setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, ApplyPropertyLength<&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY>::createHandler()); setPropertyHandler(CSSPropertyWebkitPrintColorAdjust, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitRegionOverflow, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitRtlOrdering, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler()); setPropertyHandler(CSSPropertyWebkitTextSecurity, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitTransformOrigin, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitTransformOriginX, ApplyPropertyLength<&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX>::createHandler()); setPropertyHandler(CSSPropertyWebkitTransformOriginY, ApplyPropertyLength<&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY>::createHandler()); setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyWebkitTransformStyle, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation::createHandler()); setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSStyleSelector::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); setPropertyHandler(CSSPropertyWebkitUserDrag, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitUserModify, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitUserSelect, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitWrap, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyWebkitWrapFlow, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitWrapMargin, ApplyPropertyLength<&RenderStyle::wrapMargin, &RenderStyle::setWrapMargin, &RenderStyle::initialWrapMargin>::createHandler()); setPropertyHandler(CSSPropertyWebkitWrapPadding, ApplyPropertyLength<&RenderStyle::wrapPadding, &RenderStyle::setWrapPadding, &RenderStyle::initialWrapPadding>::createHandler()); setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWidows, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyOrphans, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto::createHandler()); setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler()); } }