Source/WebCore/ChangeLog

 12013-04-12 Dirk Schulze <krit@webkit.org>
 2
 3 Rename StyleBuilder to DeprecatedStyleBuilder
 4 https://bugs.webkit.org/show_bug.cgi?id=114532
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 The StyleBuilder code is hard to read and maintain. People sould
 9 not add new properties to this class. To make this clear, this
 10 patch renames the class to DeprecatedStyleBuilder.
 11
 12 Pure refactoring, no change in functionality.
 13
 14 * CMakeLists.txt:
 15 * GNUmakefile.list.am:
 16 * Target.pri:
 17 * WebCore.vcproj/WebCore.vcproj:
 18 * WebCore.vcxproj/WebCore.vcxproj.filters:
 19 * WebCore.xcodeproj/project.pbxproj:
 20 * css/CSSAllInOne.cpp:
 21 * css/DeprecatedStyleBuilder.cpp: Renamed from Source/WebCore/css/StyleBuilder.cpp.
 22 * css/DeprecatedStyleBuilder.h: Renamed from Source/WebCore/css/StyleBuilder.h.
 23 * css/StyleResolver.cpp:
 24 (WebCore::StyleResolver::StyleResolver):
 25 (WebCore::StyleResolver::applyProperty):
 26 (WebCore::StyleResolver::reportMemoryUsage):
 27 * css/StyleResolver.h:
 28 (StyleResolver):
 29 * rendering/style/RenderStyle.h:
 30
1312013-04-12 Alberto Garcia <agarcia@igalia.com>
232
333 [BlackBerry] Upstream the filesystem code

Source/WebCore/CMakeLists.txt

@@set(WebCore_SOURCES
10641064 css/CSSValueList.cpp
10651065 css/CSSValuePool.cpp
10661066 css/DOMWindowCSS.cpp
 1067 css/DeprecatedStyleBuilder.cpp
10671068 css/DocumentRuleSets.cpp
10681069 css/ElementRuleCollector.cpp
10691070 css/FontFeatureValue.cpp

@@set(WebCore_SOURCES
10901091 css/SelectorCheckerFastPath.cpp
10911092 css/SelectorFilter.cpp
10921093 css/ShadowValue.cpp
1093  css/StyleBuilder.cpp
10941094 css/StyleInvalidationAnalysis.cpp
10951095 css/StyleMedia.cpp
10961096 css/StylePropertySet.cpp

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
26772677 Source/WebCore/css/DOMWindowCSS.cpp \
26782678 Source/WebCore/css/DOMWindowCSS.h \
26792679 Source/WebCore/css/DashboardRegion.h \
 2680 Source/WebCore/css/DeprecatedStyleBuilder.cpp \
 2681 Source/WebCore/css/DeprecatedStyleBuilder.h \
26802682 Source/WebCore/css/DocumentRuleSets.cpp \
26812683 Source/WebCore/css/DocumentRuleSets.h \
26822684 Source/WebCore/css/ElementRuleCollector.cpp \

@@webcore_sources += \
27282730 Source/WebCore/css/ShadowValue.cpp \
27292731 Source/WebCore/css/ShadowValue.h \
27302732 Source/WebCore/css/SiblingTraversalStrategies.h \
2731  Source/WebCore/css/StyleBuilder.cpp \
2732  Source/WebCore/css/StyleBuilder.h \
27332733 Source/WebCore/css/StyleInvalidationAnalysis.cpp \
27342734 Source/WebCore/css/StyleInvalidationAnalysis.h \
27352735 Source/WebCore/css/StyleMedia.cpp \

Source/WebCore/Target.pri

@@SOURCES += \
306306 css/CSSValueList.cpp \
307307 css/CSSValuePool.cpp \
308308 css/DOMWindowCSS.cpp \
 309 css/DeprecatedStyleBuilder.cpp \
309310 css/DocumentRuleSets.cpp \
310311 css/ElementRuleCollector.cpp \
311312 css/FontFeatureValue.cpp \

@@SOURCES += \
330331 css/SelectorCheckerFastPath.cpp \
331332 css/SelectorFilter.cpp \
332333 css/ShadowValue.cpp \
333  css/StyleBuilder.cpp \
334334 css/StyleInvalidationAnalysis.cpp \
335335 css/StyleMedia.cpp \
336336 css/StylePropertySet.cpp \

@@HEADERS += \
15541554 css/CSSValueList.h \
15551555 css/CSSValuePool.h \
15561556 css/CSSVariableValue.h \
 1557 css/DeprecatedStyleBuilder.h \
15571558 css/DOMWindowCSS.h \
15581559 css/FontFeatureValue.h \
15591560 css/FontLoader.h \

@@HEADERS += \
15721573 css/ShadowValue.h \
15731574 css/SiblingTraversalStrategies.h \
15741575 css/StyleMedia.h \
1575  css/StyleBuilder.h \
15761576 css/StyleInvalidationAnalysis.h \
15771577 css/StylePropertySet.h \
15781578 css/StylePropertyShorthand.h \

Source/WebCore/WebCore.vcproj/WebCore.vcproj

3831938319 >
3832038320 </File>
3832138321 <File
 38322 RelativePath="..\css\DeprecatedStyleBuilder.cpp"
 38323 >
 38324 <FileConfiguration
 38325 Name="Debug|Win32"
 38326 ExcludedFromBuild="true"
 38327 >
 38328 <Tool
 38329 Name="VCCLCompilerTool"
 38330 />
 38331 </FileConfiguration>
 38332 <FileConfiguration
 38333 Name="Release|Win32"
 38334 ExcludedFromBuild="true"
 38335 >
 38336 <Tool
 38337 Name="VCCLCompilerTool"
 38338 />
 38339 </FileConfiguration>
 38340 <FileConfiguration
 38341 Name="Debug_Cairo_CFLite|Win32"
 38342 ExcludedFromBuild="true"
 38343 >
 38344 <Tool
 38345 Name="VCCLCompilerTool"
 38346 />
 38347 </FileConfiguration>
 38348 <FileConfiguration
 38349 Name="Release_Cairo_CFLite|Win32"
 38350 ExcludedFromBuild="true"
 38351 >
 38352 <Tool
 38353 Name="VCCLCompilerTool"
 38354 />
 38355 </FileConfiguration>
 38356 <FileConfiguration
 38357 Name="Debug_All|Win32"
 38358 ExcludedFromBuild="true"
 38359 >
 38360 <Tool
 38361 Name="VCCLCompilerTool"
 38362 />
 38363 </FileConfiguration>
 38364 <FileConfiguration
 38365 Name="Production|Win32"
 38366 ExcludedFromBuild="true"
 38367 >
 38368 <Tool
 38369 Name="VCCLCompilerTool"
 38370 />
 38371 </FileConfiguration>
 38372 </File>
 38373 <File
 38374 RelativePath="..\css\DeprecatedStyleBuilder.h"
 38375 >
 38376 </File>
 38377 <File
3832238378 RelativePath="..\css\FontFeatureValue.cpp"
3832338379 >
3832438380 </File>

3864738703 >
3864838704 </File>
3864938705 <File
38650  RelativePath="..\css\StyleBuilder.cpp"
38651  >
38652  <FileConfiguration
38653  Name="Debug|Win32"
38654  ExcludedFromBuild="true"
38655  >
38656  <Tool
38657  Name="VCCLCompilerTool"
38658  />
38659  </FileConfiguration>
38660  <FileConfiguration
38661  Name="Release|Win32"
38662  ExcludedFromBuild="true"
38663  >
38664  <Tool
38665  Name="VCCLCompilerTool"
38666  />
38667  </FileConfiguration>
38668  <FileConfiguration
38669  Name="Debug_Cairo_CFLite|Win32"
38670  ExcludedFromBuild="true"
38671  >
38672  <Tool
38673  Name="VCCLCompilerTool"
38674  />
38675  </FileConfiguration>
38676  <FileConfiguration
38677  Name="Release_Cairo_CFLite|Win32"
38678  ExcludedFromBuild="true"
38679  >
38680  <Tool
38681  Name="VCCLCompilerTool"
38682  />
38683  </FileConfiguration>
38684  <FileConfiguration
38685  Name="Debug_All|Win32"
38686  ExcludedFromBuild="true"
38687  >
38688  <Tool
38689  Name="VCCLCompilerTool"
38690  />
38691  </FileConfiguration>
38692  <FileConfiguration
38693  Name="Production|Win32"
38694  ExcludedFromBuild="true"
38695  >
38696  <Tool
38697  Name="VCCLCompilerTool"
38698  />
38699  </FileConfiguration>
38700  </File>
38701  <File
38702  RelativePath="..\css\StyleBuilder.h"
38703  >
38704  </File>
38705  <File
3870638706 RelativePath="..\css\StyleInvalidationAnalysis.cpp"
3870738707 >
3870838708 </File>

Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

36933693 <ClCompile Include="..\css\CSSValuePool.cpp">
36943694 <Filter>css</Filter>
36953695 </ClCompile>
 3696 <ClCompile Include="..\css\DeprecatedStyleBuilder.cpp">
 3697 <Filter>css</Filter>
 3698 </ClCompile>
36963699 <ClCompile Include="..\css\FontFeatureValue.cpp">
36973700 <Filter>css</Filter>
36983701 </ClCompile>

37443747 <ClCompile Include="..\css\ShadowValue.cpp">
37453748 <Filter>css</Filter>
37463749 </ClCompile>
3747  <ClCompile Include="..\css\StyleBuilder.cpp">
3748  <Filter>css</Filter>
3749  </ClCompile>
37503750 <ClCompile Include="..\css\StyleInvalidationAnalysis.cpp">
37513751 <Filter>css</Filter>
37523752 </ClCompile>

1047910479 <ClInclude Include="..\css\DashboardRegion.h">
1048010480 <Filter>css</Filter>
1048110481 </ClInclude>
 10482 <ClInclude Include="..\css\DeprecatedStyleBuilder.h">
 10483 <Filter>css</Filter>
 10484 </ClInclude>
1048210485 <ClInclude Include="..\css\FontFeatureValue.h">
1048310486 <Filter>css</Filter>
1048410487 </ClInclude>

1053610539 <ClInclude Include="..\css\SiblingTraversalStrategies.h">
1053710540 <Filter>css</Filter>
1053810541 </ClInclude>
10539  <ClInclude Include="..\css\StyleBuilder.h">
10540  <Filter>css</Filter>
10541  </ClInclude>
1054210542 <ClInclude Include="..\css\StyleInvalidationAnalysis.h">
1054310543 <Filter>css</Filter>
1054410544 </ClInclude>

Source/WebCore/WebCore.xcodeproj/project.pbxproj

53505350 E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */; };
53515351 E0FEF372B37C53EAC1C1FBEE /* JSEventSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */; };
53525352 E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */; };
5353  E100EE751546EAC100BA11D1 /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E100EE731546EAC100BA11D1 /* StyleBuilder.cpp */; };
5354  E100EE761546EAC100BA11D1 /* StyleBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E100EE741546EAC100BA11D1 /* StyleBuilder.h */; };
 5353 E100EE751546EAC100BA11D1 /* DeprecatedStyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E100EE731546EAC100BA11D1 /* DeprecatedStyleBuilder.cpp */; };
 5354 E100EE761546EAC100BA11D1 /* DeprecatedStyleBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E100EE741546EAC100BA11D1 /* DeprecatedStyleBuilder.h */; };
53555355 E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */; };
53565356 E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = E107400C0E77BDC00033AF24 /* JSMessageChannel.h */; };
53575357 E10B937C0B73C00A003ED890 /* JSCustomXPathNSResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */; };

1212612126 E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventSource.cpp; sourceTree = "<group>"; };
1212712127 E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSource.h; sourceTree = "<group>"; };
1212812128 E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSource.cpp; sourceTree = "<group>"; };
12129  E100EE731546EAC100BA11D1 /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
12130  E100EE741546EAC100BA11D1 /* StyleBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilder.h; sourceTree = "<group>"; };
 12129 E100EE731546EAC100BA11D1 /* DeprecatedStyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedStyleBuilder.cpp; sourceTree = "<group>"; };
 12130 E100EE741546EAC100BA11D1 /* DeprecatedStyleBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedStyleBuilder.h; sourceTree = "<group>"; };
1213112131 E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannel.cpp; sourceTree = "<group>"; };
1213212132 E107400C0E77BDC00033AF24 /* JSMessageChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessageChannel.h; sourceTree = "<group>"; };
1213312133 E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomXPathNSResolver.h; sourceTree = "<group>"; };

1977019770 E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */,
1977119771 CAE9F90E146441F000C245B1 /* CSSVariableValue.h */,
1977219772 A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */,
 19773 E100EE731546EAC100BA11D1 /* DeprecatedStyleBuilder.cpp */,
 19774 E100EE741546EAC100BA11D1 /* DeprecatedStyleBuilder.h */,
1977319775 4A4F48A716B0DFC000EDBB29 /* DocumentRuleSets.cpp */,
1977419776 4A4F48A816B0DFC000EDBB29 /* DocumentRuleSets.h */,
1977519777 FC9A0F72164094CF003D6B8D /* DOMWindowCSS.h */,

1983919841 A80E6CCA0A1989CA007FB8C5 /* ShadowValue.cpp */,
1984019842 A80E6CBE0A1989CA007FB8C5 /* ShadowValue.h */,
1984119843 5728BD9D1625369600C40B56 /* SiblingTraversalStrategies.h */,
19842  E100EE731546EAC100BA11D1 /* StyleBuilder.cpp */,
19843  E100EE741546EAC100BA11D1 /* StyleBuilder.h */,
1984419844 E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */,
1984519845 E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */,
1984619846 0FF5026E102BA9660066F39A /* StyleMedia.cpp */,

2348223482 849F77760EFEC6200090849D /* StrokeStyleApplier.h in Headers */,
2348323483 BC5EB6A30E81DC4F00B25965 /* StyleBackgroundData.h in Headers */,
2348423484 BC5EB67B0E81D3BE00B25965 /* StyleBoxData.h in Headers */,
23485  E100EE761546EAC100BA11D1 /* StyleBuilder.h in Headers */,
 23485 E100EE761546EAC100BA11D1 /* DeprecatedStyleBuilder.h in Headers */,
2348623486 BCEF444D0E674628001C1287 /* StyleCachedImage.h in Headers */,
2348723487 9393E605151A9A1800066F06 /* StyleCachedImageSet.h in Headers */,
2348823488 5038BE301472AD230095E0D1 /* StyleCachedShader.h in Headers */,

2653926539 B23540F20D00782E002382FA /* StringTruncator.cpp in Sources */,
2654026540 BC5EB6A20E81DC4F00B25965 /* StyleBackgroundData.cpp in Sources */,
2654126541 BC5EB67D0E81D42000B25965 /* StyleBoxData.cpp in Sources */,
26542  E100EE751546EAC100BA11D1 /* StyleBuilder.cpp in Sources */,
 26542 E100EE751546EAC100BA11D1 /* DeprecatedStyleBuilder.cpp in Sources */,
2654326543 BCEF447A0E6747D0001C1287 /* StyleCachedImage.cpp in Sources */,
2654426544 9393E604151A9A1800066F06 /* StyleCachedImageSet.cpp in Sources */,
2654526545 5038BE2F1472AD230095E0D1 /* StyleCachedShader.cpp in Sources */,

Source/WebCore/css/CSSAllInOne.cpp

7070#include "CSSValueList.cpp"
7171#include "CSSValuePool.cpp"
7272#include "DOMWindowCSS.cpp"
 73#include "DeprecatedStyleBuilder.cpp"
7374#include "DocumentRuleSets.cpp"
7475#include "ElementRuleCollector.cpp"
7576#include "InspectorCSSOMWrappers.cpp"

7879#include "RuleSet.cpp"
7980#include "SelectorCheckerFastPath.cpp"
8081#include "SelectorFilter.cpp"
81 #include "StyleBuilder.cpp"
8282#include "StylePropertySet.cpp"
8383#include "StylePropertyShorthand.cpp"
8484#include "StyleResolver.cpp"

Source/WebCore/css/DeprecatedStyleBuilder.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 23 */
 24
 25#include "config.h"
 26#include "DeprecatedStyleBuilder.h"
 27
 28#include "BasicShapeFunctions.h"
 29#include "BasicShapes.h"
 30#include "CSSAspectRatioValue.h"
 31#include "CSSCalculationValue.h"
 32#include "CSSCursorImageValue.h"
 33#include "CSSPrimitiveValueMappings.h"
 34#include "CSSToStyleMap.h"
 35#include "CSSValueList.h"
 36#include "ClipPathOperation.h"
 37#include "CursorList.h"
 38#include "Document.h"
 39#include "Element.h"
 40#include "Pair.h"
 41#include "Rect.h"
 42#include "RenderObject.h"
 43#include "RenderStyle.h"
 44#include "RenderView.h"
 45#include "Settings.h"
 46#include "StyleResolver.h"
 47#include <wtf/StdLibExtras.h>
 48#include <wtf/UnusedParam.h>
 49
 50#if ENABLE(CSS_EXCLUSIONS)
 51#include "ExclusionShapeValue.h"
 52#endif
 53
 54using namespace std;
 55
 56namespace WebCore {
 57
 58enum ExpandValueBehavior {SuppressValue = 0, ExpandValue};
 59template <ExpandValueBehavior expandValue, CSSPropertyID one = CSSPropertyInvalid, CSSPropertyID two = CSSPropertyInvalid, CSSPropertyID three = CSSPropertyInvalid, CSSPropertyID four = CSSPropertyInvalid, CSSPropertyID five = CSSPropertyInvalid>
 60class ApplyPropertyExpanding {
 61public:
 62
 63 template <CSSPropertyID id>
 64 static inline void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 65 {
 66 if (id == CSSPropertyInvalid)
 67 return;
 68
 69 const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
 70 const PropertyHandler& handler = table.propertyHandler(id);
 71 if (handler.isValid())
 72 handler.applyInheritValue(propertyID, styleResolver);
 73 }
 74
 75 static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 76 {
 77 applyInheritValue<one>(propertyID, styleResolver);
 78 applyInheritValue<two>(propertyID, styleResolver);
 79 applyInheritValue<three>(propertyID, styleResolver);
 80 applyInheritValue<four>(propertyID, styleResolver);
 81 applyInheritValue<five>(propertyID, styleResolver);
 82 }
 83
 84 template <CSSPropertyID id>
 85 static inline void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 86 {
 87 if (id == CSSPropertyInvalid)
 88 return;
 89
 90 const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
 91 const PropertyHandler& handler = table.propertyHandler(id);
 92 if (handler.isValid())
 93 handler.applyInitialValue(propertyID, styleResolver);
 94 }
 95
 96 static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 97 {
 98 applyInitialValue<one>(propertyID, styleResolver);
 99 applyInitialValue<two>(propertyID, styleResolver);
 100 applyInitialValue<three>(propertyID, styleResolver);
 101 applyInitialValue<four>(propertyID, styleResolver);
 102 applyInitialValue<five>(propertyID, styleResolver);
 103 }
 104
 105 template <CSSPropertyID id>
 106 static inline void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
 107 {
 108 if (id == CSSPropertyInvalid)
 109 return;
 110
 111 const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
 112 const PropertyHandler& handler = table.propertyHandler(id);
 113 if (handler.isValid())
 114 handler.applyValue(propertyID, styleResolver, value);
 115 }
 116
 117 static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
 118 {
 119 if (!expandValue)
 120 return;
 121
 122 applyValue<one>(propertyID, styleResolver, value);
 123 applyValue<two>(propertyID, styleResolver, value);
 124 applyValue<three>(propertyID, styleResolver, value);
 125 applyValue<four>(propertyID, styleResolver, value);
 126 applyValue<five>(propertyID, styleResolver, value);
 127 }
 128 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 129};
 130
 131template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
 132class ApplyPropertyDefaultBase {
 133public:
 134 static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
 135 static GetterType value(RenderStyle* style) { return (style->*getterFunction)(); }
 136 static InitialType initial() { return (*initialFunction)(); }
 137 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), value(styleResolver->parentStyle())); }
 138 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), initial()); }
 139 static void applyValue(CSSPropertyID, StyleResolver*, CSSValue*) { }
 140 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 141};
 142
 143template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
 144class ApplyPropertyDefault {
 145public:
 146 static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
 147 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 148 {
 149 if (value->isPrimitiveValue())
 150 setValue(styleResolver->style(), *static_cast<CSSPrimitiveValue*>(value));
 151 }
 152 static PropertyHandler createHandler()
 153 {
 154 PropertyHandler handler = ApplyPropertyDefaultBase<GetterType, getterFunction, SetterType, setterFunction, InitialType, initialFunction>::createHandler();
 155 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 156 }
 157};
 158
 159template <typename NumberType, NumberType (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(NumberType), NumberType (*initialFunction)(), int idMapsToMinusOne = CSSValueAuto>
 160class ApplyPropertyNumber {
 161public:
 162 static void setValue(RenderStyle* style, NumberType value) { (style->*setterFunction)(value); }
 163 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 164 {
 165 if (!value->isPrimitiveValue())
 166 return;
 167
 168 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 169 if (primitiveValue->getIdent() == idMapsToMinusOne)
 170 setValue(styleResolver->style(), -1);
 171 else
 172 setValue(styleResolver->style(), primitiveValue->getValue<NumberType>(CSSPrimitiveValue::CSS_NUMBER));
 173 }
 174 static PropertyHandler createHandler()
 175 {
 176 PropertyHandler handler = ApplyPropertyDefaultBase<NumberType, getterFunction, NumberType, setterFunction, NumberType, initialFunction>::createHandler();
 177 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 178 }
 179};
 180
 181template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSSPropertyID property>
 182class ApplyPropertyStyleImage {
 183public:
 184 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(property, value)); }
 185 static PropertyHandler createHandler()
 186 {
 187 PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
 188 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 189 }
 190};
 191
 192enum AutoValueType {Number = 0, ComputeLength};
 193template <typename T, T (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(T), bool (RenderStyle::*hasAutoFunction)() const, void (RenderStyle::*setAutoFunction)(), AutoValueType valueType = Number, int autoIdentity = CSSValueAuto>
 194class ApplyPropertyAuto {
 195public:
 196 static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
 197 static T value(RenderStyle* style) { return (style->*getterFunction)(); }
 198 static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)(); }
 199 static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); }
 200
 201 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 202 {
 203 if (hasAuto(styleResolver->parentStyle()))
 204 setAuto(styleResolver->style());
 205 else
 206 setValue(styleResolver->style(), value(styleResolver->parentStyle()));
 207 }
 208
 209 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setAuto(styleResolver->style()); }
 210
 211 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 212 {
 213 if (!value->isPrimitiveValue())
 214 return;
 215
 216 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 217 if (primitiveValue->getIdent() == autoIdentity)
 218 setAuto(styleResolver->style());
 219 else if (valueType == Number)
 220 setValue(styleResolver->style(), *primitiveValue);
 221 else if (valueType == ComputeLength)
 222 setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
 223 }
 224
 225 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 226};
 227
 228class ApplyPropertyClip {
 229private:
 230 static Length convertToLength(StyleResolver* styleResolver, CSSPrimitiveValue* value)
 231 {
 232 return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
 233 }
 234public:
 235 static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 236 {
 237 RenderStyle* parentStyle = styleResolver->parentStyle();
 238 if (!parentStyle->hasClip())
 239 return applyInitialValue(propertyID, styleResolver);
 240 styleResolver->style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft());
 241 styleResolver->style()->setHasClip(true);
 242 }
 243
 244 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 245 {
 246 styleResolver->style()->setClip(Length(), Length(), Length(), Length());
 247 styleResolver->style()->setHasClip(false);
 248 }
 249
 250 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 251 {
 252 if (!value->isPrimitiveValue())
 253 return;
 254
 255 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 256
 257 if (Rect* rect = primitiveValue->getRectValue()) {
 258 Length top = convertToLength(styleResolver, rect->top());
 259 Length right = convertToLength(styleResolver, rect->right());
 260 Length bottom = convertToLength(styleResolver, rect->bottom());
 261 Length left = convertToLength(styleResolver, rect->left());
 262 styleResolver->style()->setClip(top, right, bottom, left);
 263 styleResolver->style()->setHasClip(true);
 264 } else if (primitiveValue->getIdent() == CSSValueAuto) {
 265 styleResolver->style()->setClip(Length(), Length(), Length(), Length());
 266 styleResolver->style()->setHasClip(false);
 267 }
 268 }
 269
 270 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 271};
 272
 273enum ColorInherit {NoInheritFromParent = 0, InheritFromParent};
 274Color defaultInitialColor();
 275Color defaultInitialColor() { return Color(); }
 276template <ColorInherit inheritColorFromParent,
 277 Color (RenderStyle::*getterFunction)() const,
 278 void (RenderStyle::*setterFunction)(const Color&),
 279 void (RenderStyle::*visitedLinkSetterFunction)(const Color&),
 280 Color (RenderStyle::*defaultFunction)() const,
 281 Color (*initialFunction)() = &defaultInitialColor>
 282class ApplyPropertyColor {
 283public:
 284 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 285 {
 286 // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
 287 Color color = (styleResolver->parentStyle()->*getterFunction)();
 288 applyColorValue(styleResolver, color.isValid() ? color : (styleResolver->parentStyle()->*defaultFunction)());
 289 }
 290
 291 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 292 {
 293 applyColorValue(styleResolver, initialFunction());
 294 }
 295
 296 static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
 297 {
 298 if (!value->isPrimitiveValue())
 299 return;
 300
 301 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 302 if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
 303 applyInheritValue(propertyID, styleResolver);
 304 else {
 305 if (styleResolver->applyPropertyToRegularStyle())
 306 (styleResolver->style()->*setterFunction)(styleResolver->colorFromPrimitiveValue(primitiveValue));
 307 if (styleResolver->applyPropertyToVisitedLinkStyle())
 308 (styleResolver->style()->*visitedLinkSetterFunction)(styleResolver->colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true));
 309 }
 310 }
 311
 312 static void applyColorValue(StyleResolver* styleResolver, const Color& color)
 313 {
 314 if (styleResolver->applyPropertyToRegularStyle())
 315 (styleResolver->style()->*setterFunction)(color);
 316 if (styleResolver->applyPropertyToVisitedLinkStyle())
 317 (styleResolver->style()->*visitedLinkSetterFunction)(color);
 318 }
 319
 320 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 321};
 322
 323template <TextDirection (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(TextDirection), TextDirection (*initialFunction)()>
 324class ApplyPropertyDirection {
 325public:
 326 static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
 327 {
 328 ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(propertyID, styleResolver, value);
 329 Element* element = styleResolver->element();
 330 if (element && styleResolver->element() == element->document()->documentElement())
 331 element->document()->setDirectionSetOnDocumentElement(true);
 332 }
 333
 334 static PropertyHandler createHandler()
 335 {
 336 PropertyHandler handler = ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::createHandler();
 337 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 338 }
 339};
 340
 341enum LengthAuto { AutoDisabled = 0, AutoEnabled };
 342enum LengthLegacyIntrinsic { LegacyIntrinsicDisabled = 0, LegacyIntrinsicEnabled };
 343enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled };
 344enum LengthNone { NoneDisabled = 0, NoneEnabled };
 345enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled };
 346template <Length (RenderStyle::*getterFunction)() const,
 347 void (RenderStyle::*setterFunction)(Length),
 348 Length (*initialFunction)(),
 349 LengthAuto autoEnabled = AutoDisabled,
 350 LengthLegacyIntrinsic legacyIntrinsicEnabled = LegacyIntrinsicDisabled,
 351 LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
 352 LengthNone noneEnabled = NoneDisabled,
 353 LengthUndefined noneUndefined = UndefinedDisabled>
 354class ApplyPropertyLength {
 355public:
 356 static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); }
 357 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 358 {
 359 if (!value->isPrimitiveValue())
 360 return;
 361
 362 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 363 if (noneEnabled && primitiveValue->getIdent() == CSSValueNone) {
 364 if (noneUndefined)
 365 setValue(styleResolver->style(), Length(Undefined));
 366 else
 367 setValue(styleResolver->style(), Length());
 368 }
 369 if (legacyIntrinsicEnabled) {
 370 if (primitiveValue->getIdent() == CSSValueIntrinsic)
 371 setValue(styleResolver->style(), Length(Intrinsic));
 372 else if (primitiveValue->getIdent() == CSSValueMinIntrinsic)
 373 setValue(styleResolver->style(), Length(MinIntrinsic));
 374 }
 375 if (intrinsicEnabled) {
 376 if (primitiveValue->getIdent() == CSSValueWebkitMinContent)
 377 setValue(styleResolver->style(), Length(MinContent));
 378 else if (primitiveValue->getIdent() == CSSValueWebkitMaxContent)
 379 setValue(styleResolver->style(), Length(MaxContent));
 380 else if (primitiveValue->getIdent() == CSSValueWebkitFillAvailable)
 381 setValue(styleResolver->style(), Length(FillAvailable));
 382 else if (primitiveValue->getIdent() == CSSValueWebkitFitContent)
 383 setValue(styleResolver->style(), Length(FitContent));
 384 }
 385
 386 if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
 387 setValue(styleResolver->style(), Length());
 388 else if (primitiveValue->isLength()) {
 389 Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
 390 length.setQuirk(primitiveValue->isQuirkValue());
 391 setValue(styleResolver->style(), length);
 392 } else if (primitiveValue->isPercentage())
 393 setValue(styleResolver->style(), Length(primitiveValue->getDoubleValue(), Percent));
 394 else if (primitiveValue->isCalculatedPercentageWithLength())
 395 setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
 396 else if (primitiveValue->isViewportPercentageLength())
 397 setValue(styleResolver->style(), primitiveValue->viewportPercentageLength());
 398 }
 399
 400 static PropertyHandler createHandler()
 401 {
 402 PropertyHandler handler = ApplyPropertyDefaultBase<Length, getterFunction, Length, setterFunction, Length, initialFunction>::createHandler();
 403 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 404 }
 405};
 406
 407enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull };
 408template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(const AtomicString&), const AtomicString& (*initialFunction)()>
 409class ApplyPropertyString {
 410public:
 411 static void setValue(RenderStyle* style, const AtomicString& value) { (style->*setterFunction)(value); }
 412 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 413 {
 414 if (!value->isPrimitiveValue())
 415 return;
 416 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 417 if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSSValueNone)
 418 || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto))
 419 setValue(styleResolver->style(), nullAtom);
 420 else
 421 setValue(styleResolver->style(), primitiveValue->getStringValue());
 422 }
 423 static PropertyHandler createHandler()
 424 {
 425 PropertyHandler handler = ApplyPropertyDefaultBase<const AtomicString&, getterFunction, const AtomicString&, setterFunction, const AtomicString&, initialFunction>::createHandler();
 426 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 427 }
 428};
 429
 430template <LengthSize (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
 431class ApplyPropertyBorderRadius {
 432public:
 433 static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(value); }
 434 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 435 {
 436 if (!value->isPrimitiveValue())
 437 return;
 438
 439 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 440 Pair* pair = primitiveValue->getPairValue();
 441 if (!pair || !pair->first() || !pair->second())
 442 return;
 443
 444 Length radiusWidth;
 445 Length radiusHeight;
 446 if (pair->first()->isPercentage())
 447 radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
 448 else if (pair->first()->isViewportPercentageLength())
 449 radiusWidth = pair->first()->viewportPercentageLength();
 450 else if (pair->first()->isCalculatedPercentageWithLength())
 451 radiusWidth = Length((pair->first()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
 452 else
 453 radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
 454 if (pair->second()->isPercentage())
 455 radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
 456 else if (pair->second()->isViewportPercentageLength())
 457 radiusHeight = pair->second()->viewportPercentageLength();
 458 else if (pair->second()->isCalculatedPercentageWithLength())
 459 radiusHeight = Length((pair->second()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
 460 else
 461 radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
 462 int width = radiusWidth.value();
 463 int height = radiusHeight.value();
 464 if (width < 0 || height < 0)
 465 return;
 466 if (!width)
 467 radiusHeight = radiusWidth; // Null out the other value.
 468 else if (!height)
 469 radiusWidth = radiusHeight; // Null out the other value.
 470
 471 LengthSize size(radiusWidth, radiusHeight);
 472 setValue(styleResolver->style(), size);
 473 }
 474 static PropertyHandler createHandler()
 475 {
 476 PropertyHandler handler = ApplyPropertyDefaultBase<LengthSize, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
 477 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 478 }
 479};
 480
 481template <typename T>
 482struct FillLayerAccessorTypes {
 483 typedef T Setter;
 484 typedef T Getter;
 485};
 486
 487template <>
 488struct FillLayerAccessorTypes<StyleImage*> {
 489 typedef PassRefPtr<StyleImage> Setter;
 490 typedef StyleImage* Getter;
 491};
 492
 493template <typename T,
 494 CSSPropertyID propertyId,
 495 EFillLayerType fillLayerType,
 496 FillLayer* (RenderStyle::*accessLayersFunction)(),
 497 const FillLayer* (RenderStyle::*layersFunction)() const,
 498 bool (FillLayer::*testFunction)() const,
 499 typename FillLayerAccessorTypes<T>::Getter (FillLayer::*getFunction)() const,
 500 void (FillLayer::*setFunction)(typename FillLayerAccessorTypes<T>::Setter),
 501 void (FillLayer::*clearFunction)(),
 502 typename FillLayerAccessorTypes<T>::Getter (*initialFunction)(EFillLayerType),
 503 void (CSSToStyleMap::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)>
 504class ApplyPropertyFillLayer {
 505public:
 506 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 507 {
 508 FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
 509 FillLayer* prevChild = 0;
 510 const FillLayer* currParent = (styleResolver->parentStyle()->*layersFunction)();
 511 while (currParent && (currParent->*testFunction)()) {
 512 if (!currChild) {
 513 /* Need to make a new layer.*/
 514 currChild = new FillLayer(fillLayerType);
 515 prevChild->setNext(currChild);
 516 }
 517 (currChild->*setFunction)((currParent->*getFunction)());
 518 prevChild = currChild;
 519 currChild = prevChild->next();
 520 currParent = currParent->next();
 521 }
 522
 523 while (currChild) {
 524 /* Reset any remaining layers to not have the property set. */
 525 (currChild->*clearFunction)();
 526 currChild = currChild->next();
 527 }
 528 }
 529
 530 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 531 {
 532 FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
 533 (currChild->*setFunction)((*initialFunction)(fillLayerType));
 534 for (currChild = currChild->next(); currChild; currChild = currChild->next())
 535 (currChild->*clearFunction)();
 536 }
 537
 538 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 539 {
 540 FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
 541 FillLayer* prevChild = 0;
 542 if (value->isValueList()
 543#if ENABLE(CSS_IMAGE_SET)
 544 && !value->isImageSetValue()
 545#endif
 546 ) {
 547 /* Walk each value and put it into a layer, creating new layers as needed. */
 548 CSSValueList* valueList = static_cast<CSSValueList*>(value);
 549 for (unsigned int i = 0; i < valueList->length(); i++) {
 550 if (!currChild) {
 551 /* Need to make a new layer to hold this value */
 552 currChild = new FillLayer(fillLayerType);
 553 prevChild->setNext(currChild);
 554 }
 555 (styleResolver->styleMap()->*mapFillFunction)(propertyId, currChild, valueList->itemWithoutBoundsCheck(i));
 556 prevChild = currChild;
 557 currChild = currChild->next();
 558 }
 559 } else {
 560 (styleResolver->styleMap()->*mapFillFunction)(propertyId, currChild, value);
 561 currChild = currChild->next();
 562 }
 563 while (currChild) {
 564 /* Reset all remaining layers to not have the property set. */
 565 (currChild->*clearFunction)();
 566 currChild = currChild->next();
 567 }
 568 }
 569
 570 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 571};
 572
 573enum ComputeLengthNormal {NormalDisabled = 0, NormalEnabled};
 574enum ComputeLengthThickness {ThicknessDisabled = 0, ThicknessEnabled};
 575enum ComputeLengthSVGZoom {SVGZoomDisabled = 0, SVGZoomEnabled};
 576template <typename T,
 577 T (RenderStyle::*getterFunction)() const,
 578 void (RenderStyle::*setterFunction)(T),
 579 T (*initialFunction)(),
 580 ComputeLengthNormal normalEnabled = NormalDisabled,
 581 ComputeLengthThickness thicknessEnabled = ThicknessDisabled,
 582 ComputeLengthSVGZoom svgZoomEnabled = SVGZoomDisabled>
 583class ApplyPropertyComputeLength {
 584public:
 585 static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
 586 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 587 {
 588 // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason...
 589 if (!value->isPrimitiveValue())
 590 return;
 591
 592 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 593
 594 int ident = primitiveValue->getIdent();
 595 T length;
 596 if (normalEnabled && ident == CSSValueNormal) {
 597 length = 0;
 598 } else if (thicknessEnabled && ident == CSSValueThin) {
 599 length = 1;
 600 } else if (thicknessEnabled && ident == CSSValueMedium) {
 601 length = 3;
 602 } else if (thicknessEnabled && ident == CSSValueThick) {
 603 length = 5;
 604 } else if (ident == CSSValueInvalid) {
 605 float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom();
 606
 607 // Any original result that was >= 1 should not be allowed to fall below 1.
 608 // This keeps border lines from vanishing.
 609 length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), zoom);
 610 if (zoom < 1.0f && length < 1.0) {
 611 T originalLength = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), 1.0);
 612 if (originalLength >= 1.0)
 613 length = 1.0;
 614 }
 615
 616 } else {
 617 ASSERT_NOT_REACHED();
 618 length = 0;
 619 }
 620
 621 setValue(styleResolver->style(), length);
 622 }
 623 static PropertyHandler createHandler()
 624 {
 625 PropertyHandler handler = ApplyPropertyDefaultBase<T, getterFunction, T, setterFunction, T, initialFunction>::createHandler();
 626 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 627 }
 628};
 629
 630template <typename T, T (FontDescription::*getterFunction)() const, void (FontDescription::*setterFunction)(T), T initialValue>
 631class ApplyPropertyFont {
 632public:
 633 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 634 {
 635 FontDescription fontDescription = styleResolver->fontDescription();
 636 (fontDescription.*setterFunction)((styleResolver->parentFontDescription().*getterFunction)());
 637 styleResolver->setFontDescription(fontDescription);
 638 }
 639
 640 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 641 {
 642 FontDescription fontDescription = styleResolver->fontDescription();
 643 (fontDescription.*setterFunction)(initialValue);
 644 styleResolver->setFontDescription(fontDescription);
 645 }
 646
 647 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 648 {
 649 if (!value->isPrimitiveValue())
 650 return;
 651 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 652 FontDescription fontDescription = styleResolver->fontDescription();
 653 (fontDescription.*setterFunction)(*primitiveValue);
 654 styleResolver->setFontDescription(fontDescription);
 655 }
 656
 657 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 658};
 659
 660class ApplyPropertyFontFamily {
 661public:
 662 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 663 {
 664 FontDescription fontDescription = styleResolver->style()->fontDescription();
 665 FontDescription parentFontDescription = styleResolver->parentStyle()->fontDescription();
 666
 667 fontDescription.setGenericFamily(parentFontDescription.genericFamily());
 668 fontDescription.setFamily(parentFontDescription.firstFamily());
 669 fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());
 670 styleResolver->setFontDescription(fontDescription);
 671 return;
 672 }
 673
 674 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 675 {
 676 FontDescription fontDescription = styleResolver->style()->fontDescription();
 677 FontDescription initialDesc = FontDescription();
 678
 679 // We need to adjust the size to account for the generic family change from monospace to non-monospace.
 680 if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize())
 681 styleResolver->setFontSize(fontDescription, styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, false));
 682 fontDescription.setGenericFamily(initialDesc.genericFamily());
 683 if (!initialDesc.firstFamily().familyIsEmpty())
 684 fontDescription.setFamily(initialDesc.firstFamily());
 685
 686 styleResolver->setFontDescription(fontDescription);
 687 return;
 688 }
 689
 690 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 691 {
 692 if (!value->isValueList())
 693 return;
 694
 695 FontDescription fontDescription = styleResolver->style()->fontDescription();
 696 FontFamily& firstFamily = fontDescription.firstFamily();
 697 FontFamily* currFamily = 0;
 698
 699 // Before mapping in a new font-family property, we should reset the generic family.
 700 bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
 701 fontDescription.setGenericFamily(FontDescription::NoFamily);
 702
 703 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
 704 CSSValue* item = i.value();
 705 if (!item->isPrimitiveValue())
 706 continue;
 707 CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(item);
 708 AtomicString face;
 709 Settings* settings = styleResolver->document()->settings();
 710 if (contentValue->isString())
 711 face = contentValue->getStringValue();
 712 else if (settings) {
 713 switch (contentValue->getIdent()) {
 714 case CSSValueWebkitBody:
 715 face = settings->standardFontFamily();
 716 break;
 717 case CSSValueSerif:
 718 face = serifFamily;
 719 fontDescription.setGenericFamily(FontDescription::SerifFamily);
 720 break;
 721 case CSSValueSansSerif:
 722 face = sansSerifFamily;
 723 fontDescription.setGenericFamily(FontDescription::SansSerifFamily);
 724 break;
 725 case CSSValueCursive:
 726 face = cursiveFamily;
 727 fontDescription.setGenericFamily(FontDescription::CursiveFamily);
 728 break;
 729 case CSSValueFantasy:
 730 face = fantasyFamily;
 731 fontDescription.setGenericFamily(FontDescription::FantasyFamily);
 732 break;
 733 case CSSValueMonospace:
 734 face = monospaceFamily;
 735 fontDescription.setGenericFamily(FontDescription::MonospaceFamily);
 736 break;
 737 case CSSValueWebkitPictograph:
 738 face = pictographFamily;
 739 fontDescription.setGenericFamily(FontDescription::PictographFamily);
 740 break;
 741 }
 742 }
 743
 744 if (!face.isEmpty()) {
 745 if (!currFamily) {
 746 // Filling in the first family.
 747 firstFamily.setFamily(face);
 748 firstFamily.appendFamily(0); // Remove any inherited family-fallback list.
 749 currFamily = &firstFamily;
 750 fontDescription.setIsSpecifiedFont(fontDescription.genericFamily() == FontDescription::NoFamily);
 751 } else {
 752 RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create();
 753 newFamily->setFamily(face);
 754 currFamily->appendFamily(newFamily);
 755 currFamily = newFamily.get();
 756 }
 757 }
 758 }
 759
 760 // We can't call useFixedDefaultSize() until all new font families have been added
 761 // If currFamily is non-zero then we set at least one family on this description.
 762 if (currFamily) {
 763 if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
 764 styleResolver->setFontSize(fontDescription, styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize));
 765
 766 styleResolver->setFontDescription(fontDescription);
 767 }
 768 return;
 769 }
 770
 771 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 772};
 773
 774class ApplyPropertyFontSize {
 775private:
 776 // When the CSS keyword "larger" is used, this function will attempt to match within the keyword
 777 // table, and failing that, will simply multiply by 1.2.
 778 static float largerFontSize(float size)
 779 {
 780 // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to
 781 // the next size level.
 782 return size * 1.2f;
 783 }
 784
 785 // Like the previous function, but for the keyword "smaller".
 786 static float smallerFontSize(float size)
 787 {
 788 // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to
 789 // the next size level.
 790 return size / 1.2f;
 791 }
 792public:
 793 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 794 {
 795 float size = styleResolver->parentStyle()->fontDescription().specifiedSize();
 796
 797 if (size < 0)
 798 return;
 799
 800 FontDescription fontDescription = styleResolver->style()->fontDescription();
 801 fontDescription.setKeywordSize(styleResolver->parentStyle()->fontDescription().keywordSize());
 802 styleResolver->setFontSize(fontDescription, size);
 803 styleResolver->setFontDescription(fontDescription);
 804 return;
 805 }
 806
 807 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 808 {
 809 FontDescription fontDescription = styleResolver->style()->fontDescription();
 810 float size = styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueMedium, fontDescription.useFixedDefaultSize());
 811
 812 if (size < 0)
 813 return;
 814
 815 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
 816 styleResolver->setFontSize(fontDescription, size);
 817 styleResolver->setFontDescription(fontDescription);
 818 return;
 819 }
 820
 821 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 822 {
 823 if (!value->isPrimitiveValue())
 824 return;
 825
 826 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 827
 828 FontDescription fontDescription = styleResolver->style()->fontDescription();
 829 fontDescription.setKeywordSize(0);
 830 float parentSize = 0;
 831 bool parentIsAbsoluteSize = false;
 832 float size = 0;
 833
 834 if (styleResolver->parentStyle()) {
 835 parentSize = styleResolver->parentStyle()->fontDescription().specifiedSize();
 836 parentIsAbsoluteSize = styleResolver->parentStyle()->fontDescription().isAbsoluteSize();
 837 }
 838
 839 if (int ident = primitiveValue->getIdent()) {
 840 // Keywords are being used.
 841 switch (ident) {
 842 case CSSValueXxSmall:
 843 case CSSValueXSmall:
 844 case CSSValueSmall:
 845 case CSSValueMedium:
 846 case CSSValueLarge:
 847 case CSSValueXLarge:
 848 case CSSValueXxLarge:
 849 case CSSValueWebkitXxxLarge:
 850 size = styleResolver->fontSizeForKeyword(styleResolver->document(), ident, fontDescription.useFixedDefaultSize());
 851 fontDescription.setKeywordSize(ident - CSSValueXxSmall + 1);
 852 break;
 853 case CSSValueLarger:
 854 size = largerFontSize(parentSize);
 855 break;
 856 case CSSValueSmaller:
 857 size = smallerFontSize(parentSize);
 858 break;
 859 default:
 860 return;
 861 }
 862
 863 fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (ident == CSSValueLarger || ident == CSSValueSmaller));
 864 } else {
 865 fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
 866 || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
 867 if (primitiveValue->isLength())
 868 size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0, true);
 869 else if (primitiveValue->isPercentage())
 870 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
 871 else if (primitiveValue->isCalculatedPercentageWithLength())
 872 size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize);
 873 else if (primitiveValue->isViewportPercentageLength())
 874 size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document()->renderView());
 875 else
 876 return;
 877 }
 878
 879 if (size < 0)
 880 return;
 881
 882 // Overly large font sizes will cause crashes on some platforms (such as Windows).
 883 // Cap font size here to make sure that doesn't happen.
 884 size = min(maximumAllowedFontSize, size);
 885
 886 styleResolver->setFontSize(fontDescription, size);
 887 styleResolver->setFontDescription(fontDescription);
 888 return;
 889 }
 890
 891 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 892};
 893
 894class ApplyPropertyFontWeight {
 895public:
 896 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 897 {
 898 if (!value->isPrimitiveValue())
 899 return;
 900 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 901 FontDescription fontDescription = styleResolver->fontDescription();
 902 switch (primitiveValue->getIdent()) {
 903 case CSSValueInvalid:
 904 ASSERT_NOT_REACHED();
 905 break;
 906 case CSSValueBolder:
 907 fontDescription.setWeight(fontDescription.bolderWeight());
 908 break;
 909 case CSSValueLighter:
 910 fontDescription.setWeight(fontDescription.lighterWeight());
 911 break;
 912 default:
 913 fontDescription.setWeight(*primitiveValue);
 914 }
 915 styleResolver->setFontDescription(fontDescription);
 916 }
 917 static PropertyHandler createHandler()
 918 {
 919 PropertyHandler handler = ApplyPropertyFont<FontWeight, &FontDescription::weight, &FontDescription::setWeight, FontWeightNormal>::createHandler();
 920 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 921 }
 922};
 923
 924class ApplyPropertyFontVariantLigatures {
 925public:
 926 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 927 {
 928 const FontDescription& parentFontDescription = styleResolver->parentFontDescription();
 929 FontDescription fontDescription = styleResolver->fontDescription();
 930
 931 fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState());
 932 fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState());
 933 fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState());
 934
 935 styleResolver->setFontDescription(fontDescription);
 936 }
 937
 938 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 939 {
 940 FontDescription fontDescription = styleResolver->fontDescription();
 941
 942 fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState);
 943 fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState);
 944 fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState);
 945
 946 styleResolver->setFontDescription(fontDescription);
 947 }
 948
 949 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 950 {
 951 FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState;
 952 FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState;
 953 FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
 954
 955 if (value->isValueList()) {
 956 CSSValueList* valueList = static_cast<CSSValueList*>(value);
 957 for (size_t i = 0; i < valueList->length(); ++i) {
 958 CSSValue* item = valueList->itemWithoutBoundsCheck(i);
 959 ASSERT(item->isPrimitiveValue());
 960 if (item->isPrimitiveValue()) {
 961 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
 962 switch (primitiveValue->getIdent()) {
 963 case CSSValueNoCommonLigatures:
 964 commonLigaturesState = FontDescription::DisabledLigaturesState;
 965 break;
 966 case CSSValueCommonLigatures:
 967 commonLigaturesState = FontDescription::EnabledLigaturesState;
 968 break;
 969 case CSSValueNoDiscretionaryLigatures:
 970 discretionaryLigaturesState = FontDescription::DisabledLigaturesState;
 971 break;
 972 case CSSValueDiscretionaryLigatures:
 973 discretionaryLigaturesState = FontDescription::EnabledLigaturesState;
 974 break;
 975 case CSSValueNoHistoricalLigatures:
 976 historicalLigaturesState = FontDescription::DisabledLigaturesState;
 977 break;
 978 case CSSValueHistoricalLigatures:
 979 historicalLigaturesState = FontDescription::EnabledLigaturesState;
 980 break;
 981 default:
 982 ASSERT_NOT_REACHED();
 983 break;
 984 }
 985 }
 986 }
 987 }
 988#if !ASSERT_DISABLED
 989 else {
 990 ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
 991 ASSERT(static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueNormal);
 992 }
 993#endif
 994
 995 FontDescription fontDescription = styleResolver->fontDescription();
 996 fontDescription.setCommonLigaturesState(commonLigaturesState);
 997 fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState);
 998 fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
 999 styleResolver->setFontDescription(fontDescription);
 1000 }
 1001
 1002 static PropertyHandler createHandler()
 1003 {
 1004 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
 1005 }
 1006};
 1007
 1008enum BorderImageType { BorderImage = 0, BorderMask };
 1009template <BorderImageType borderImageType,
 1010 CSSPropertyID property,
 1011 const NinePieceImage& (RenderStyle::*getterFunction)() const,
 1012 void (RenderStyle::*setterFunction)(const NinePieceImage&)>
 1013class ApplyPropertyBorderImage {
 1014public:
 1015 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1016 {
 1017 NinePieceImage image;
 1018 if (borderImageType == BorderMask)
 1019 image.setMaskDefaults();
 1020 styleResolver->styleMap()->mapNinePieceImage(property, value, image);
 1021 (styleResolver->style()->*setterFunction)(image);
 1022 }
 1023
 1024 static PropertyHandler createHandler()
 1025 {
 1026 PropertyHandler handler = ApplyPropertyDefaultBase<const NinePieceImage&, getterFunction, const NinePieceImage&, setterFunction, NinePieceImage, &RenderStyle::initialNinePieceImage>::createHandler();
 1027 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1028 }
 1029};
 1030
 1031enum BorderImageModifierType { Outset, Repeat, Slice, Width };
 1032template <BorderImageType type, BorderImageModifierType modifier>
 1033class ApplyPropertyBorderImageModifier {
 1034private:
 1035 static inline const NinePieceImage& getValue(RenderStyle* style) { return type == BorderImage ? style->borderImage() : style->maskBoxImage(); }
 1036 static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == BorderImage ? style->setBorderImage(value) : style->setMaskBoxImage(value); }
 1037public:
 1038 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 1039 {
 1040 NinePieceImage image(getValue(styleResolver->style()));
 1041 switch (modifier) {
 1042 case Outset:
 1043 image.copyOutsetFrom(getValue(styleResolver->parentStyle()));
 1044 break;
 1045 case Repeat:
 1046 image.copyRepeatFrom(getValue(styleResolver->parentStyle()));
 1047 break;
 1048 case Slice:
 1049 image.copyImageSlicesFrom(getValue(styleResolver->parentStyle()));
 1050 break;
 1051 case Width:
 1052 image.copyBorderSlicesFrom(getValue(styleResolver->parentStyle()));
 1053 break;
 1054 }
 1055 setValue(styleResolver->style(), image);
 1056 }
 1057
 1058 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 1059 {
 1060 NinePieceImage image(getValue(styleResolver->style()));
 1061 switch (modifier) {
 1062 case Outset:
 1063 image.setOutset(LengthBox(0));
 1064 break;
 1065 case Repeat:
 1066 image.setHorizontalRule(StretchImageRule);
 1067 image.setVerticalRule(StretchImageRule);
 1068 break;
 1069 case Slice:
 1070 // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility.
 1071 image.setImageSlices(type == BorderImage ? LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)) : LengthBox());
 1072 image.setFill(false);
 1073 break;
 1074 case Width:
 1075 // Masks have a different initial value for widths. They use an 'auto' value rather than trying to fit to the border.
 1076 image.setBorderSlices(type == BorderImage ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox());
 1077 break;
 1078 }
 1079 setValue(styleResolver->style(), image);
 1080 }
 1081
 1082 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1083 {
 1084 NinePieceImage image(getValue(styleResolver->style()));
 1085 switch (modifier) {
 1086 case Outset:
 1087 image.setOutset(styleResolver->styleMap()->mapNinePieceImageQuad(value));
 1088 break;
 1089 case Repeat:
 1090 styleResolver->styleMap()->mapNinePieceImageRepeat(value, image);
 1091 break;
 1092 case Slice:
 1093 styleResolver->styleMap()->mapNinePieceImageSlice(value, image);
 1094 break;
 1095 case Width:
 1096 image.setBorderSlices(styleResolver->styleMap()->mapNinePieceImageQuad(value));
 1097 break;
 1098 }
 1099 setValue(styleResolver->style(), image);
 1100 }
 1101
 1102 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 1103};
 1104
 1105template <CSSPropertyID id, StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)()>
 1106class ApplyPropertyBorderImageSource {
 1107public:
 1108 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(id, value)); }
 1109 static PropertyHandler createHandler()
 1110 {
 1111 PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
 1112 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1113 }
 1114};
 1115
 1116enum CounterBehavior {Increment = 0, Reset};
 1117template <CounterBehavior counterBehavior>
 1118class ApplyPropertyCounter {
 1119public:
 1120 static void emptyFunction(CSSPropertyID, StyleResolver*) { }
 1121 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 1122 {
 1123 CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
 1124 CounterDirectiveMap& parentMap = styleResolver->parentStyle()->accessCounterDirectives();
 1125
 1126 typedef CounterDirectiveMap::iterator Iterator;
 1127 Iterator end = parentMap.end();
 1128 for (Iterator it = parentMap.begin(); it != end; ++it) {
 1129 CounterDirectives& directives = map.add(it->key, CounterDirectives()).iterator->value;
 1130 if (counterBehavior == Reset) {
 1131 directives.inheritReset(it->value);
 1132 } else {
 1133 directives.inheritIncrement(it->value);
 1134 }
 1135 }
 1136 }
 1137 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1138 {
 1139 bool setCounterIncrementToNone = counterBehavior == Increment && value->isPrimitiveValue() && static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueNone;
 1140
 1141 if (!value->isValueList() && !setCounterIncrementToNone)
 1142 return;
 1143
 1144 CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
 1145 typedef CounterDirectiveMap::iterator Iterator;
 1146
 1147 Iterator end = map.end();
 1148 for (Iterator it = map.begin(); it != end; ++it)
 1149 if (counterBehavior == Reset)
 1150 it->value.clearReset();
 1151 else
 1152 it->value.clearIncrement();
 1153
 1154 if (setCounterIncrementToNone)
 1155 return;
 1156
 1157 CSSValueList* list = static_cast<CSSValueList*>(value);
 1158 int length = list ? list->length() : 0;
 1159 for (int i = 0; i < length; ++i) {
 1160 CSSValue* currValue = list->itemWithoutBoundsCheck(i);
 1161 if (!currValue->isPrimitiveValue())
 1162 continue;
 1163
 1164 Pair* pair = static_cast<CSSPrimitiveValue*>(currValue)->getPairValue();
 1165 if (!pair || !pair->first() || !pair->second())
 1166 continue;
 1167
 1168 AtomicString identifier = static_cast<CSSPrimitiveValue*>(pair->first())->getStringValue();
 1169 int value = static_cast<CSSPrimitiveValue*>(pair->second())->getIntValue();
 1170 CounterDirectives& directives = map.add(identifier, CounterDirectives()).iterator->value;
 1171 if (counterBehavior == Reset) {
 1172 directives.setResetValue(value);
 1173 } else {
 1174 directives.addIncrementValue(value);
 1175 }
 1176 }
 1177 }
 1178 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &emptyFunction, &applyValue); }
 1179};
 1180
 1181
 1182class ApplyPropertyCursor {
 1183public:
 1184 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 1185 {
 1186 styleResolver->style()->setCursor(styleResolver->parentStyle()->cursor());
 1187 styleResolver->style()->setCursorList(styleResolver->parentStyle()->cursors());
 1188 }
 1189
 1190 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 1191 {
 1192 styleResolver->style()->clearCursorList();
 1193 styleResolver->style()->setCursor(RenderStyle::initialCursor());
 1194 }
 1195
 1196 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1197 {
 1198 styleResolver->style()->clearCursorList();
 1199 if (value->isValueList()) {
 1200 CSSValueList* list = static_cast<CSSValueList*>(value);
 1201 int len = list->length();
 1202 styleResolver->style()->setCursor(CURSOR_AUTO);
 1203 for (int i = 0; i < len; i++) {
 1204 CSSValue* item = list->itemWithoutBoundsCheck(i);
 1205 if (item->isCursorImageValue()) {
 1206 CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(item);
 1207 if (image->updateIfSVGCursorIsUsed(styleResolver->element())) // Elements with SVG cursors are not allowed to share style.
 1208 styleResolver->style()->setUnique();
 1209 styleResolver->style()->addCursor(styleResolver->styleImage(CSSPropertyCursor, image), image->hotSpot());
 1210 } else if (item->isPrimitiveValue()) {
 1211 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
 1212 if (primitiveValue->isIdent())
 1213 styleResolver->style()->setCursor(*primitiveValue);
 1214 }
 1215 }
 1216 } else if (value->isPrimitiveValue()) {
 1217 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1218 if (primitiveValue->isIdent() && styleResolver->style()->cursor() != ECursor(*primitiveValue))
 1219 styleResolver->style()->setCursor(*primitiveValue);
 1220 }
 1221 }
 1222
 1223 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 1224};
 1225
 1226class ApplyPropertyTextAlign {
 1227public:
 1228 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1229 {
 1230 if (!value->isPrimitiveValue())
 1231 return;
 1232
 1233 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1234
 1235 if (primitiveValue->getIdent() != CSSValueWebkitMatchParent)
 1236 styleResolver->style()->setTextAlign(*primitiveValue);
 1237 else if (styleResolver->parentStyle()->textAlign() == TASTART)
 1238 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
 1239 else if (styleResolver->parentStyle()->textAlign() == TAEND)
 1240 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);
 1241 else
 1242 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->textAlign());
 1243 }
 1244 static PropertyHandler createHandler()
 1245 {
 1246 PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlign, ETextAlign, &RenderStyle::setTextAlign, ETextAlign, &RenderStyle::initialTextAlign>::createHandler();
 1247 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1248 }
 1249};
 1250
 1251class ApplyPropertyTextDecoration {
 1252public:
 1253 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1254 {
 1255 ETextDecoration t = RenderStyle::initialTextDecoration();
 1256 for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
 1257 CSSValue* item = i.value();
 1258 ASSERT_WITH_SECURITY_IMPLICATION(item->isPrimitiveValue());
 1259 t |= *static_cast<CSSPrimitiveValue*>(item);
 1260 }
 1261 styleResolver->style()->setTextDecoration(t);
 1262 }
 1263 static PropertyHandler createHandler()
 1264 {
 1265 PropertyHandler handler = ApplyPropertyDefaultBase<ETextDecoration, &RenderStyle::textDecoration, ETextDecoration, &RenderStyle::setTextDecoration, ETextDecoration, &RenderStyle::initialTextDecoration>::createHandler();
 1266 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1267 }
 1268};
 1269
 1270class ApplyPropertyMarqueeIncrement {
 1271public:
 1272 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1273 {
 1274 if (!value->isPrimitiveValue())
 1275 return;
 1276
 1277 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1278 if (primitiveValue->getIdent()) {
 1279 switch (primitiveValue->getIdent()) {
 1280 case CSSValueSmall:
 1281 styleResolver->style()->setMarqueeIncrement(Length(1, Fixed)); // 1px.
 1282 break;
 1283 case CSSValueNormal:
 1284 styleResolver->style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default.
 1285 break;
 1286 case CSSValueLarge:
 1287 styleResolver->style()->setMarqueeIncrement(Length(36, Fixed)); // 36px.
 1288 break;
 1289 }
 1290 } else {
 1291 Length marqueeLength = styleResolver->convertToIntLength(primitiveValue, styleResolver->style(), styleResolver->rootElementStyle());
 1292 if (!marqueeLength.isUndefined())
 1293 styleResolver->style()->setMarqueeIncrement(marqueeLength);
 1294 }
 1295 }
 1296 static PropertyHandler createHandler()
 1297 {
 1298 PropertyHandler handler = ApplyPropertyLength<&RenderStyle::marqueeIncrement, &RenderStyle::setMarqueeIncrement, &RenderStyle::initialMarqueeIncrement>::createHandler();
 1299 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1300 }
 1301};
 1302
 1303class ApplyPropertyMarqueeRepetition {
 1304public:
 1305 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1306 {
 1307 if (!value->isPrimitiveValue())
 1308 return;
 1309
 1310 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1311 if (primitiveValue->getIdent() == CSSValueInfinite)
 1312 styleResolver->style()->setMarqueeLoopCount(-1); // -1 means repeat forever.
 1313 else if (primitiveValue->isNumber())
 1314 styleResolver->style()->setMarqueeLoopCount(primitiveValue->getIntValue());
 1315 }
 1316 static PropertyHandler createHandler()
 1317 {
 1318 PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeLoopCount, int, &RenderStyle::setMarqueeLoopCount, int, &RenderStyle::initialMarqueeLoopCount>::createHandler();
 1319 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1320 }
 1321};
 1322
 1323class ApplyPropertyMarqueeSpeed {
 1324public:
 1325 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1326 {
 1327 if (!value->isPrimitiveValue())
 1328 return;
 1329
 1330 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1331 if (int ident = primitiveValue->getIdent()) {
 1332 switch (ident) {
 1333 case CSSValueSlow:
 1334 styleResolver->style()->setMarqueeSpeed(500); // 500 msec.
 1335 break;
 1336 case CSSValueNormal:
 1337 styleResolver->style()->setMarqueeSpeed(85); // 85msec. The WinIE default.
 1338 break;
 1339 case CSSValueFast:
 1340 styleResolver->style()->setMarqueeSpeed(10); // 10msec. Super fast.
 1341 break;
 1342 }
 1343 } else if (primitiveValue->isTime())
 1344 styleResolver->style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>());
 1345 else if (primitiveValue->isNumber()) // For scrollamount support.
 1346 styleResolver->style()->setMarqueeSpeed(primitiveValue->getIntValue());
 1347 }
 1348 static PropertyHandler createHandler()
 1349 {
 1350 PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeSpeed, int, &RenderStyle::setMarqueeSpeed, int, &RenderStyle::initialMarqueeSpeed>::createHandler();
 1351 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1352 }
 1353};
 1354
 1355#if ENABLE(CSS3_TEXT)
 1356class ApplyPropertyTextUnderlinePosition {
 1357public:
 1358 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1359 {
 1360 // This is true if value is 'auto' or 'alphabetic'.
 1361 if (value->isPrimitiveValue()) {
 1362 TextUnderlinePosition t = *static_cast<CSSPrimitiveValue*>(value);
 1363 styleResolver->style()->setTextUnderlinePosition(t);
 1364 return;
 1365 }
 1366
 1367 unsigned t = 0;
 1368 for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
 1369 CSSValue* item = i.value();
 1370 ASSERT(item->isPrimitiveValue());
 1371 TextUnderlinePosition t2 = *static_cast<CSSPrimitiveValue*>(item);
 1372 t |= t2;
 1373 }
 1374 styleResolver->style()->setTextUnderlinePosition(static_cast<TextUnderlinePosition>(t));
 1375 }
 1376 static PropertyHandler createHandler()
 1377 {
 1378 PropertyHandler handler = ApplyPropertyDefaultBase<TextUnderlinePosition, &RenderStyle::textUnderlinePosition, TextUnderlinePosition, &RenderStyle::setTextUnderlinePosition, TextUnderlinePosition, &RenderStyle::initialTextUnderlinePosition>::createHandler();
 1379 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1380 }
 1381};
 1382#endif // CSS3_TEXT
 1383
 1384class ApplyPropertyLineHeight {
 1385public:
 1386 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1387 {
 1388 if (!value->isPrimitiveValue())
 1389 return;
 1390
 1391 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1392 Length lineHeight;
 1393
 1394 if (primitiveValue->getIdent() == CSSValueNormal)
 1395 lineHeight = RenderStyle::initialLineHeight();
 1396 else if (primitiveValue->isLength()) {
 1397 double multiplier = styleResolver->style()->effectiveZoom();
 1398 if (Frame* frame = styleResolver->document()->frame())
 1399 multiplier *= frame->textZoomFactor();
 1400 lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
 1401 } else if (primitiveValue->isPercentage()) {
 1402 // FIXME: percentage should not be restricted to an integer here.
 1403 lineHeight = Length((styleResolver->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
 1404 } else if (primitiveValue->isNumber()) {
 1405 // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
 1406 lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
 1407 } else if (primitiveValue->isViewportPercentageLength())
 1408 lineHeight = primitiveValue->viewportPercentageLength();
 1409 else
 1410 return;
 1411 styleResolver->style()->setLineHeight(lineHeight);
 1412 }
 1413 static PropertyHandler createHandler()
 1414 {
 1415 PropertyHandler handler = ApplyPropertyDefaultBase<Length, &RenderStyle::specifiedLineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
 1416 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1417 }
 1418};
 1419
 1420class ApplyPropertyPageSize {
 1421private:
 1422 static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0); }
 1423 static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
 1424 static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
 1425 {
 1426 DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
 1427 DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210)));
 1428 DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210)));
 1429 DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297)));
 1430 DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297)));
 1431 DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420)));
 1432 DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176)));
 1433 DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250)));
 1434 DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250)));
 1435 DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353)));
 1436 DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
 1437 DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
 1438 DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
 1439 DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
 1440 DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
 1441 DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));
 1442
 1443 if (!pageSizeName)
 1444 return false;
 1445
 1446 switch (pageSizeName->getIdent()) {
 1447 case CSSValueA5:
 1448 width = a5Width;
 1449 height = a5Height;
 1450 break;
 1451 case CSSValueA4:
 1452 width = a4Width;
 1453 height = a4Height;
 1454 break;
 1455 case CSSValueA3:
 1456 width = a3Width;
 1457 height = a3Height;
 1458 break;
 1459 case CSSValueB5:
 1460 width = b5Width;
 1461 height = b5Height;
 1462 break;
 1463 case CSSValueB4:
 1464 width = b4Width;
 1465 height = b4Height;
 1466 break;
 1467 case CSSValueLetter:
 1468 width = letterWidth;
 1469 height = letterHeight;
 1470 break;
 1471 case CSSValueLegal:
 1472 width = legalWidth;
 1473 height = legalHeight;
 1474 break;
 1475 case CSSValueLedger:
 1476 width = ledgerWidth;
 1477 height = ledgerHeight;
 1478 break;
 1479 default:
 1480 return false;
 1481 }
 1482
 1483 if (pageOrientation) {
 1484 switch (pageOrientation->getIdent()) {
 1485 case CSSValueLandscape:
 1486 std::swap(width, height);
 1487 break;
 1488 case CSSValuePortrait:
 1489 // Nothing to do.
 1490 break;
 1491 default:
 1492 return false;
 1493 }
 1494 }
 1495 return true;
 1496 }
 1497public:
 1498 static void applyInheritValue(CSSPropertyID, StyleResolver*) { }
 1499 static void applyInitialValue(CSSPropertyID, StyleResolver*) { }
 1500 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1501 {
 1502 styleResolver->style()->resetPageSizeType();
 1503 Length width;
 1504 Length height;
 1505 PageSizeType pageSizeType = PAGE_SIZE_AUTO;
 1506 CSSValueListInspector inspector(value);
 1507 switch (inspector.length()) {
 1508 case 2: {
 1509 // <length>{2} | <page-size> <orientation>
 1510 if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue())
 1511 return;
 1512 CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(inspector.first());
 1513 CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(inspector.second());
 1514 if (first->isLength()) {
 1515 // <length>{2}
 1516 if (!second->isLength())
 1517 return;
 1518 width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
 1519 height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
 1520 } else {
 1521 // <page-size> <orientation>
 1522 // The value order is guaranteed. See CSSParser::parseSizeParameter.
 1523 if (!getPageSizeFromName(first, second, width, height))
 1524 return;
 1525 }
 1526 pageSizeType = PAGE_SIZE_RESOLVED;
 1527 break;
 1528 }
 1529 case 1: {
 1530 // <length> | auto | <page-size> | [ portrait | landscape]
 1531 if (!inspector.first()->isPrimitiveValue())
 1532 return;
 1533 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(inspector.first());
 1534 if (primitiveValue->isLength()) {
 1535 // <length>
 1536 pageSizeType = PAGE_SIZE_RESOLVED;
 1537 width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
 1538 } else {
 1539 switch (primitiveValue->getIdent()) {
 1540 case 0:
 1541 return;
 1542 case CSSValueAuto:
 1543 pageSizeType = PAGE_SIZE_AUTO;
 1544 break;
 1545 case CSSValuePortrait:
 1546 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT;
 1547 break;
 1548 case CSSValueLandscape:
 1549 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE;
 1550 break;
 1551 default:
 1552 // <page-size>
 1553 pageSizeType = PAGE_SIZE_RESOLVED;
 1554 if (!getPageSizeFromName(primitiveValue, 0, width, height))
 1555 return;
 1556 }
 1557 }
 1558 break;
 1559 }
 1560 default:
 1561 return;
 1562 }
 1563 styleResolver->style()->setPageSizeType(pageSizeType);
 1564 styleResolver->style()->setPageSize(LengthSize(width, height));
 1565 }
 1566 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 1567};
 1568
 1569class ApplyPropertyTextEmphasisStyle {
 1570public:
 1571 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 1572 {
 1573 styleResolver->style()->setTextEmphasisFill(styleResolver->parentStyle()->textEmphasisFill());
 1574 styleResolver->style()->setTextEmphasisMark(styleResolver->parentStyle()->textEmphasisMark());
 1575 styleResolver->style()->setTextEmphasisCustomMark(styleResolver->parentStyle()->textEmphasisCustomMark());
 1576 }
 1577
 1578 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 1579 {
 1580 styleResolver->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
 1581 styleResolver->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
 1582 styleResolver->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
 1583 }
 1584
 1585 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1586 {
 1587 if (value->isValueList()) {
 1588 CSSValueList* list = static_cast<CSSValueList*>(value);
 1589 ASSERT(list->length() == 2);
 1590 if (list->length() != 2)
 1591 return;
 1592 for (unsigned i = 0; i < 2; ++i) {
 1593 CSSValue* item = list->itemWithoutBoundsCheck(i);
 1594 if (!item->isPrimitiveValue())
 1595 continue;
 1596
 1597 CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(item);
 1598 if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen)
 1599 styleResolver->style()->setTextEmphasisFill(*value);
 1600 else
 1601 styleResolver->style()->setTextEmphasisMark(*value);
 1602 }
 1603 styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
 1604 return;
 1605 }
 1606
 1607 if (!value->isPrimitiveValue())
 1608 return;
 1609 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1610
 1611 if (primitiveValue->isString()) {
 1612 styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
 1613 styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
 1614 styleResolver->style()->setTextEmphasisCustomMark(primitiveValue->getStringValue());
 1615 return;
 1616 }
 1617
 1618 styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
 1619
 1620 if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getIdent() == CSSValueOpen) {
 1621 styleResolver->style()->setTextEmphasisFill(*primitiveValue);
 1622 styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
 1623 } else {
 1624 styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
 1625 styleResolver->style()->setTextEmphasisMark(*primitiveValue);
 1626 }
 1627 }
 1628
 1629 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 1630};
 1631
 1632template <typename T,
 1633 T (Animation::*getterFunction)() const,
 1634 void (Animation::*setterFunction)(T),
 1635 bool (Animation::*testFunction)() const,
 1636 void (Animation::*clearFunction)(),
 1637 T (*initialFunction)(),
 1638 void (CSSToStyleMap::*mapFunction)(Animation*, CSSValue*),
 1639 AnimationList* (RenderStyle::*animationGetterFunction)(),
 1640 const AnimationList* (RenderStyle::*immutableAnimationGetterFunction)() const>
 1641class ApplyPropertyAnimation {
 1642public:
 1643 static void setValue(Animation* animation, T value) { (animation->*setterFunction)(value); }
 1644 static T value(const Animation* animation) { return (animation->*getterFunction)(); }
 1645 static bool test(const Animation* animation) { return (animation->*testFunction)(); }
 1646 static void clear(Animation* animation) { (animation->*clearFunction)(); }
 1647 static T initial() { return (*initialFunction)(); }
 1648 static void map(StyleResolver* styleResolver, Animation* animation, CSSValue* value) { (styleResolver->styleMap()->*mapFunction)(animation, value); }
 1649 static AnimationList* accessAnimations(RenderStyle* style) { return (style->*animationGetterFunction)(); }
 1650 static const AnimationList* animations(RenderStyle* style) { return (style->*immutableAnimationGetterFunction)(); }
 1651
 1652 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 1653 {
 1654 AnimationList* list = accessAnimations(styleResolver->style());
 1655 const AnimationList* parentList = animations(styleResolver->parentStyle());
 1656 size_t i = 0, parentSize = parentList ? parentList->size() : 0;
 1657 for ( ; i < parentSize && test(parentList->animation(i)); ++i) {
 1658 if (list->size() <= i)
 1659 list->append(Animation::create());
 1660 setValue(list->animation(i), value(parentList->animation(i)));
 1661 list->animation(i)->setAnimationMode(parentList->animation(i)->animationMode());
 1662 }
 1663
 1664 /* Reset any remaining animations to not have the property set. */
 1665 for ( ; i < list->size(); ++i)
 1666 clear(list->animation(i));
 1667 }
 1668
 1669 static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 1670 {
 1671 AnimationList* list = accessAnimations(styleResolver->style());
 1672 if (list->isEmpty())
 1673 list->append(Animation::create());
 1674 setValue(list->animation(0), initial());
 1675 if (propertyID == CSSPropertyWebkitTransitionProperty)
 1676 list->animation(0)->setAnimationMode(Animation::AnimateAll);
 1677 for (size_t i = 1; i < list->size(); ++i)
 1678 clear(list->animation(i));
 1679 }
 1680
 1681 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1682 {
 1683 AnimationList* list = accessAnimations(styleResolver->style());
 1684 size_t childIndex = 0;
 1685 if (value->isValueList()) {
 1686 /* Walk each value and put it into an animation, creating new animations as needed. */
 1687 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
 1688 if (childIndex <= list->size())
 1689 list->append(Animation::create());
 1690 map(styleResolver, list->animation(childIndex), i.value());
 1691 ++childIndex;
 1692 }
 1693 } else {
 1694 if (list->isEmpty())
 1695 list->append(Animation::create());
 1696 map(styleResolver, list->animation(childIndex), value);
 1697 childIndex = 1;
 1698 }
 1699 for ( ; childIndex < list->size(); ++childIndex) {
 1700 /* Reset all remaining animations to not have the property set. */
 1701 clear(list->animation(childIndex));
 1702 }
 1703 }
 1704
 1705 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 1706};
 1707
 1708class ApplyPropertyOutlineStyle {
 1709public:
 1710 static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 1711 {
 1712 ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInheritValue(propertyID, styleResolver);
 1713 ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInheritValue(propertyID, styleResolver);
 1714 }
 1715
 1716 static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 1717 {
 1718 ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInitialValue(propertyID, styleResolver);
 1719 ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInitialValue(propertyID, styleResolver);
 1720 }
 1721
 1722 static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
 1723 {
 1724 ApplyPropertyDefault<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyValue(propertyID, styleResolver, value);
 1725 ApplyPropertyDefault<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyValue(propertyID, styleResolver, value);
 1726 }
 1727
 1728 static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 1729};
 1730
 1731class ApplyPropertyResize {
 1732public:
 1733 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1734 {
 1735 if (!value->isPrimitiveValue())
 1736 return;
 1737
 1738 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1739
 1740 EResize r = RESIZE_NONE;
 1741 switch (primitiveValue->getIdent()) {
 1742 case 0:
 1743 return;
 1744 case CSSValueAuto:
 1745 if (Settings* settings = styleResolver->document()->settings())
 1746 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
 1747 break;
 1748 default:
 1749 r = *primitiveValue;
 1750 }
 1751 styleResolver->style()->setResize(r);
 1752 }
 1753
 1754 static PropertyHandler createHandler()
 1755 {
 1756 PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize>::createHandler();
 1757 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1758 }
 1759};
 1760
 1761class ApplyPropertyVerticalAlign {
 1762public:
 1763 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1764 {
 1765 if (!value->isPrimitiveValue())
 1766 return;
 1767
 1768 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1769
 1770 if (primitiveValue->getIdent())
 1771 return styleResolver->style()->setVerticalAlign(*primitiveValue);
 1772
 1773 styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
 1774 }
 1775
 1776 static PropertyHandler createHandler()
 1777 {
 1778 PropertyHandler handler = ApplyPropertyDefaultBase<EVerticalAlign, &RenderStyle::verticalAlign, EVerticalAlign, &RenderStyle::setVerticalAlign, EVerticalAlign, &RenderStyle::initialVerticalAlign>::createHandler();
 1779 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1780 }
 1781};
 1782
 1783class ApplyPropertyAspectRatio {
 1784public:
 1785 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 1786 {
 1787 if (!styleResolver->parentStyle()->hasAspectRatio())
 1788 return;
 1789 styleResolver->style()->setHasAspectRatio(true);
 1790 styleResolver->style()->setAspectRatioDenominator(styleResolver->parentStyle()->aspectRatioDenominator());
 1791 styleResolver->style()->setAspectRatioNumerator(styleResolver->parentStyle()->aspectRatioNumerator());
 1792 }
 1793
 1794 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 1795 {
 1796 styleResolver->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio());
 1797 styleResolver->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
 1798 styleResolver->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
 1799 }
 1800
 1801 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1802 {
 1803 if (!value->isAspectRatioValue()) {
 1804 styleResolver->style()->setHasAspectRatio(false);
 1805 return;
 1806 }
 1807 CSSAspectRatioValue* aspectRatioValue = static_cast<CSSAspectRatioValue*>(value);
 1808 styleResolver->style()->setHasAspectRatio(true);
 1809 styleResolver->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
 1810 styleResolver->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
 1811 }
 1812
 1813 static PropertyHandler createHandler()
 1814 {
 1815 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
 1816 }
 1817};
 1818
 1819class ApplyPropertyZoom {
 1820private:
 1821 static void resetEffectiveZoom(StyleResolver* styleResolver)
 1822 {
 1823 // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.
 1824 styleResolver->setEffectiveZoom(styleResolver->parentStyle() ? styleResolver->parentStyle()->effectiveZoom() : RenderStyle::initialZoom());
 1825 }
 1826
 1827public:
 1828 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 1829 {
 1830 resetEffectiveZoom(styleResolver);
 1831 styleResolver->setZoom(styleResolver->parentStyle()->zoom());
 1832 }
 1833
 1834 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 1835 {
 1836 resetEffectiveZoom(styleResolver);
 1837 styleResolver->setZoom(RenderStyle::initialZoom());
 1838 }
 1839
 1840 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1841 {
 1842 ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
 1843 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1844
 1845 if (primitiveValue->getIdent() == CSSValueNormal) {
 1846 resetEffectiveZoom(styleResolver);
 1847 styleResolver->setZoom(RenderStyle::initialZoom());
 1848 } else if (primitiveValue->getIdent() == CSSValueReset) {
 1849 styleResolver->setEffectiveZoom(RenderStyle::initialZoom());
 1850 styleResolver->setZoom(RenderStyle::initialZoom());
 1851 } else if (primitiveValue->getIdent() == CSSValueDocument) {
 1852 float docZoom = styleResolver->rootElementStyle() ? styleResolver->rootElementStyle()->zoom() : RenderStyle::initialZoom();
 1853 styleResolver->setEffectiveZoom(docZoom);
 1854 styleResolver->setZoom(docZoom);
 1855 } else if (primitiveValue->isPercentage()) {
 1856 resetEffectiveZoom(styleResolver);
 1857 if (float percent = primitiveValue->getFloatValue())
 1858 styleResolver->setZoom(percent / 100.0f);
 1859 } else if (primitiveValue->isNumber()) {
 1860 resetEffectiveZoom(styleResolver);
 1861 if (float number = primitiveValue->getFloatValue())
 1862 styleResolver->setZoom(number);
 1863 }
 1864 }
 1865
 1866 static PropertyHandler createHandler()
 1867 {
 1868 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
 1869 }
 1870};
 1871
 1872class ApplyPropertyDisplay {
 1873private:
 1874 static inline bool isValidDisplayValue(StyleResolver* styleResolver, EDisplay displayPropertyValue)
 1875 {
 1876#if ENABLE(SVG)
 1877 if (styleResolver->element() && styleResolver->element()->isSVGElement() && styleResolver->style()->styleType() == NOPSEUDO)
 1878 return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE);
 1879#else
 1880 UNUSED_PARAM(styleResolver);
 1881 UNUSED_PARAM(displayPropertyValue);
 1882#endif
 1883 return true;
 1884 }
 1885public:
 1886 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 1887 {
 1888 EDisplay display = styleResolver->parentStyle()->display();
 1889 if (!isValidDisplayValue(styleResolver, display))
 1890 return;
 1891 styleResolver->style()->setDisplay(display);
 1892 }
 1893
 1894 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 1895 {
 1896 styleResolver->style()->setDisplay(RenderStyle::initialDisplay());
 1897 }
 1898
 1899 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1900 {
 1901 if (!value->isPrimitiveValue())
 1902 return;
 1903
 1904 EDisplay display = *static_cast<CSSPrimitiveValue*>(value);
 1905
 1906 if (!isValidDisplayValue(styleResolver, display))
 1907 return;
 1908
 1909 styleResolver->style()->setDisplay(display);
 1910 }
 1911
 1912 static PropertyHandler createHandler()
 1913 {
 1914 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
 1915 }
 1916};
 1917
 1918template <ClipPathOperation* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ClipPathOperation>), ClipPathOperation* (*initialFunction)()>
 1919class ApplyPropertyClipPath {
 1920public:
 1921 static void setValue(RenderStyle* style, PassRefPtr<ClipPathOperation> value) { (style->*setterFunction)(value); }
 1922 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1923 {
 1924 if (value->isPrimitiveValue()) {
 1925 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1926 if (primitiveValue->getIdent() == CSSValueNone)
 1927 setValue(styleResolver->style(), 0);
 1928 else if (primitiveValue->isShape()) {
 1929 setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver, primitiveValue->getShapeValue())));
 1930 }
 1931#if ENABLE(SVG)
 1932 else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) {
 1933 String cssURLValue = primitiveValue->getStringValue();
 1934 KURL url = styleResolver->document()->completeURL(cssURLValue);
 1935 // FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405)
 1936 setValue(styleResolver->style(), ReferenceClipPathOperation::create(cssURLValue, url.fragmentIdentifier()));
 1937 }
 1938#endif
 1939 }
 1940 }
 1941 static PropertyHandler createHandler()
 1942 {
 1943 PropertyHandler handler = ApplyPropertyDefaultBase<ClipPathOperation*, getterFunction, PassRefPtr<ClipPathOperation>, setterFunction, ClipPathOperation*, initialFunction>::createHandler();
 1944 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1945 }
 1946};
 1947
 1948#if ENABLE(CSS_EXCLUSIONS)
 1949template <ExclusionShapeValue* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ExclusionShapeValue>), ExclusionShapeValue* (*initialFunction)()>
 1950class ApplyPropertyExclusionShape {
 1951public:
 1952 static void setValue(RenderStyle* style, PassRefPtr<ExclusionShapeValue> value) { (style->*setterFunction)(value); }
 1953 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1954 {
 1955 if (value->isPrimitiveValue()) {
 1956 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
 1957 if (primitiveValue->getIdent() == CSSValueAuto)
 1958 setValue(styleResolver->style(), 0);
 1959 // FIXME Bug 102571: Layout for the value 'outside-shape' is not yet implemented
 1960 else if (primitiveValue->getIdent() == CSSValueOutsideShape)
 1961 setValue(styleResolver->style(), ExclusionShapeValue::createOutsideValue());
 1962 else if (primitiveValue->isShape()) {
 1963 RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createShapeValue(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()));
 1964 setValue(styleResolver->style(), shape.release());
 1965 }
 1966 }
 1967 }
 1968 static PropertyHandler createHandler()
 1969 {
 1970 PropertyHandler handler = ApplyPropertyDefaultBase<ExclusionShapeValue*, getterFunction, PassRefPtr<ExclusionShapeValue>, setterFunction, ExclusionShapeValue*, initialFunction>::createHandler();
 1971 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
 1972 }
 1973};
 1974#endif
 1975
 1976#if ENABLE(CSS_IMAGE_RESOLUTION)
 1977class ApplyPropertyImageResolution {
 1978public:
 1979 static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 1980 {
 1981 ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInheritValue(propertyID, styleResolver);
 1982 ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInheritValue(propertyID, styleResolver);
 1983 ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInheritValue(propertyID, styleResolver);
 1984 }
 1985
 1986 static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
 1987 {
 1988 ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInitialValue(propertyID, styleResolver);
 1989 ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInitialValue(propertyID, styleResolver);
 1990 ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInitialValue(propertyID, styleResolver);
 1991 }
 1992
 1993 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 1994 {
 1995 if (!value->isValueList())
 1996 return;
 1997 CSSValueList* valueList = static_cast<CSSValueList*>(value);
 1998 ImageResolutionSource source = RenderStyle::initialImageResolutionSource();
 1999 ImageResolutionSnap snap = RenderStyle::initialImageResolutionSnap();
 2000 double resolution = RenderStyle::initialImageResolution();
 2001 for (size_t i = 0; i < valueList->length(); i++) {
 2002 CSSValue* item = valueList->itemWithoutBoundsCheck(i);
 2003 if (!item->isPrimitiveValue())
 2004 continue;
 2005 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
 2006 if (primitiveValue->getIdent() == CSSValueFromImage)
 2007 source = ImageResolutionFromImage;
 2008 else if (primitiveValue->getIdent() == CSSValueSnap)
 2009 snap = ImageResolutionSnapPixels;
 2010 else
 2011 resolution = primitiveValue->getDoubleValue(CSSPrimitiveValue::CSS_DPPX);
 2012 }
 2013 styleResolver->style()->setImageResolutionSource(source);
 2014 styleResolver->style()->setImageResolutionSnap(snap);
 2015 styleResolver->style()->setImageResolution(resolution);
 2016 }
 2017
 2018 static PropertyHandler createHandler()
 2019 {
 2020 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
 2021 }
 2022};
 2023#endif
 2024
 2025class ApplyPropertyTextIndent {
 2026public:
 2027 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
 2028 {
 2029 styleResolver->style()->setTextIndent(styleResolver->parentStyle()->textIndent());
 2030#if ENABLE(CSS3_TEXT)
 2031 styleResolver->style()->setTextIndentLine(styleResolver->parentStyle()->textIndentLine());
 2032#endif
 2033 }
 2034
 2035 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
 2036 {
 2037 styleResolver->style()->setTextIndent(RenderStyle::initialTextIndent());
 2038#if ENABLE(CSS3_TEXT)
 2039 styleResolver->style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
 2040#endif
 2041 }
 2042
 2043 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
 2044 {
 2045 if (!value->isValueList())
 2046 return;
 2047
 2048 // [ <length> | <percentage> ] -webkit-each-line
 2049 // The order is guaranteed. See CSSParser::parseTextIndent.
 2050 // The second value, -webkit-each-line is handled only when CSS3_TEXT is enabled.
 2051
 2052 CSSValueList* valueList = static_cast<CSSValueList*>(value);
 2053 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valueList->itemWithoutBoundsCheck(0));
 2054 Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
 2055 ASSERT(!lengthOrPercentageValue.isUndefined());
 2056 styleResolver->style()->setTextIndent(lengthOrPercentageValue);
 2057
 2058#if ENABLE(CSS3_TEXT)
 2059 ASSERT(valueList->length() <= 2);
 2060 CSSPrimitiveValue* eachLineValue = static_cast<CSSPrimitiveValue*>(valueList->item(1));
 2061 if (eachLineValue) {
 2062 ASSERT(eachLineValue->getIdent() == CSSValueWebkitEachLine);
 2063 styleResolver->style()->setTextIndentLine(TextIndentEachLine);
 2064 } else
 2065 styleResolver->style()->setTextIndentLine(TextIndentFirstLine);
 2066#endif
 2067 }
 2068
 2069 static PropertyHandler createHandler()
 2070 {
 2071 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
 2072 }
 2073};
 2074
 2075const DeprecatedStyleBuilder& DeprecatedStyleBuilder::sharedStyleBuilder()
 2076{
 2077 DEFINE_STATIC_LOCAL(DeprecatedStyleBuilder, styleBuilderInstance, ());
 2078 return styleBuilderInstance;
 2079}
 2080
 2081DeprecatedStyleBuilder::DeprecatedStyleBuilder()
 2082{
 2083 for (int i = 0; i < numCSSProperties; ++i)
 2084 m_propertyMap[i] = PropertyHandler();
 2085
 2086 // Please keep CSS property list in alphabetical order.
 2087 setPropertyHandler(CSSPropertyBackgroundAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSToStyleMap::mapFillAttachment>::createHandler());
 2088 setPropertyHandler(CSSPropertyBackgroundClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSToStyleMap::mapFillClip>::createHandler());
 2089 setPropertyHandler(CSSPropertyBackgroundColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor, &RenderStyle::invalidColor>::createHandler());
 2090 setPropertyHandler(CSSPropertyBackgroundImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSToStyleMap::mapFillImage>::createHandler());
 2091 setPropertyHandler(CSSPropertyBackgroundOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSToStyleMap::mapFillOrigin>::createHandler());
 2092 setPropertyHandler(CSSPropertyBackgroundPositionX, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSToStyleMap::mapFillXPosition>::createHandler());
 2093 setPropertyHandler(CSSPropertyBackgroundPositionY, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSToStyleMap::mapFillYPosition>::createHandler());
 2094 setPropertyHandler(CSSPropertyBackgroundRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSToStyleMap::mapFillRepeatX>::createHandler());
 2095 setPropertyHandler(CSSPropertyBackgroundRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler());
 2096 setPropertyHandler(CSSPropertyBackgroundSize, ApplyPropertyFillLayer<FillSize, CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
 2097 setPropertyHandler(CSSPropertyBorderBottomColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor, &RenderStyle::color>::createHandler());
 2098 setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
 2099 setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
 2100 setPropertyHandler(CSSPropertyBorderBottomStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderBottomStyle, EBorderStyle, &RenderStyle::setBorderBottomStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
 2101 setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
 2102 setPropertyHandler(CSSPropertyBorderCollapse, ApplyPropertyDefault<EBorderCollapse, &RenderStyle::borderCollapse, EBorderCollapse, &RenderStyle::setBorderCollapse, EBorderCollapse, &RenderStyle::initialBorderCollapse>::createHandler());
 2103 setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier<BorderImage, Outset>::createHandler());
 2104 setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier<BorderImage, Repeat>::createHandler());
 2105 setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier<BorderImage, Slice>::createHandler());
 2106 setPropertyHandler(CSSPropertyBorderImageSource, ApplyPropertyBorderImageSource<CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource, &RenderStyle::initialBorderImageSource>::createHandler());
 2107 setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier<BorderImage, Width>::createHandler());
 2108 setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color>::createHandler());
 2109 setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderLeftStyle, EBorderStyle, &RenderStyle::setBorderLeftStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
 2110 setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
 2111 setPropertyHandler(CSSPropertyBorderRightColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color>::createHandler());
 2112 setPropertyHandler(CSSPropertyBorderRightStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderRightStyle, EBorderStyle, &RenderStyle::setBorderRightStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
 2113 setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
 2114 setPropertyHandler(CSSPropertyBorderTopColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color>::createHandler());
 2115 setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
 2116 setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
 2117 setPropertyHandler(CSSPropertyBorderTopStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderTopStyle, EBorderStyle, &RenderStyle::setBorderTopStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
 2118 setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
 2119 setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
 2120 setPropertyHandler(CSSPropertyBoxSizing, ApplyPropertyDefault<EBoxSizing, &RenderStyle::boxSizing, EBoxSizing, &RenderStyle::setBoxSizing, EBoxSizing, &RenderStyle::initialBoxSizing>::createHandler());
 2121 setPropertyHandler(CSSPropertyCaptionSide, ApplyPropertyDefault<ECaptionSide, &RenderStyle::captionSide, ECaptionSide, &RenderStyle::setCaptionSide, ECaptionSide, &RenderStyle::initialCaptionSide>::createHandler());
 2122 setPropertyHandler(CSSPropertyClear, ApplyPropertyDefault<EClear, &RenderStyle::clear, EClear, &RenderStyle::setClear, EClear, &RenderStyle::initialClear>::createHandler());
 2123 setPropertyHandler(CSSPropertyClip, ApplyPropertyClip::createHandler());
 2124 setPropertyHandler(CSSPropertyColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::setVisitedLinkColor, &RenderStyle::invalidColor, RenderStyle::initialColor>::createHandler());
 2125 setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter<Increment>::createHandler());
 2126 setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter<Reset>::createHandler());
 2127 setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler());
 2128 setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler());
 2129 setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());
 2130 setPropertyHandler(CSSPropertyEmptyCells, ApplyPropertyDefault<EEmptyCell, &RenderStyle::emptyCells, EEmptyCell, &RenderStyle::setEmptyCells, EEmptyCell, &RenderStyle::initialEmptyCells>::createHandler());
 2131 setPropertyHandler(CSSPropertyFloat, ApplyPropertyDefault<EFloat, &RenderStyle::floating, EFloat, &RenderStyle::setFloating, EFloat, &RenderStyle::initialFloating>::createHandler());
 2132 setPropertyHandler(CSSPropertyFontFamily, ApplyPropertyFontFamily::createHandler());
 2133 setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());
 2134 setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler());
 2135 setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler());
 2136 setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
 2137 setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled, NoneDisabled, UndefinedDisabled>::createHandler());
 2138#if ENABLE(CSS_IMAGE_ORIENTATION)
 2139 setPropertyHandler(CSSPropertyImageOrientation, ApplyPropertyDefault<ImageOrientationEnum, &RenderStyle::imageOrientation, ImageOrientationEnum, &RenderStyle::setImageOrientation, ImageOrientationEnum, &RenderStyle::initialImageOrientation>::createHandler());
 2140#endif
 2141 setPropertyHandler(CSSPropertyImageRendering, ApplyPropertyDefault<EImageRendering, &RenderStyle::imageRendering, EImageRendering, &RenderStyle::setImageRendering, EImageRendering, &RenderStyle::initialImageRendering>::createHandler());
 2142#if ENABLE(CSS_IMAGE_RESOLUTION)
 2143 setPropertyHandler(CSSPropertyImageResolution, ApplyPropertyImageResolution::createHandler());
 2144#endif
 2145 setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
 2146 setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
 2147 setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());
 2148 setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler());
 2149 setPropertyHandler(CSSPropertyListStylePosition, ApplyPropertyDefault<EListStylePosition, &RenderStyle::listStylePosition, EListStylePosition, &RenderStyle::setListStylePosition, EListStylePosition, &RenderStyle::initialListStylePosition>::createHandler());
 2150 setPropertyHandler(CSSPropertyListStyleType, ApplyPropertyDefault<EListStyleType, &RenderStyle::listStyleType, EListStyleType, &RenderStyle::setListStyleType, EListStyleType, &RenderStyle::initialListStyleType>::createHandler());
 2151 setPropertyHandler(CSSPropertyMarginBottom, ApplyPropertyLength<&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
 2152 setPropertyHandler(CSSPropertyMarginLeft, ApplyPropertyLength<&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
 2153 setPropertyHandler(CSSPropertyMarginRight, ApplyPropertyLength<&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
 2154 setPropertyHandler(CSSPropertyMarginTop, ApplyPropertyLength<&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
 2155 setPropertyHandler(CSSPropertyMaxHeight, ApplyPropertyLength<&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
 2156 setPropertyHandler(CSSPropertyMaxWidth, ApplyPropertyLength<&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler());
 2157 setPropertyHandler(CSSPropertyMinHeight, ApplyPropertyLength<&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled>::createHandler());
 2158 setPropertyHandler(CSSPropertyMinWidth, ApplyPropertyLength<&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled>::createHandler());
 2159 setPropertyHandler(CSSPropertyOpacity, ApplyPropertyDefault<float, &RenderStyle::opacity, float, &RenderStyle::setOpacity, float, &RenderStyle::initialOpacity>::createHandler());
 2160 setPropertyHandler(CSSPropertyOrphans, ApplyPropertyAuto<short, &RenderStyle::orphans, &RenderStyle::setOrphans, &RenderStyle::hasAutoOrphans, &RenderStyle::setHasAutoOrphans>::createHandler());
 2161 setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
 2162 setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler());
 2163 setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
 2164 setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialOutlineWidth, NormalDisabled, ThicknessEnabled>::createHandler());
 2165 setPropertyHandler(CSSPropertyOverflowWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
 2166 setPropertyHandler(CSSPropertyOverflowX, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowX, EOverflow, &RenderStyle::setOverflowX, EOverflow, &RenderStyle::initialOverflowX>::createHandler());
 2167 setPropertyHandler(CSSPropertyOverflowY, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowY, EOverflow, &RenderStyle::setOverflowY, EOverflow, &RenderStyle::initialOverflowY>::createHandler());
 2168 setPropertyHandler(CSSPropertyPaddingBottom, ApplyPropertyLength<&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding>::createHandler());
 2169 setPropertyHandler(CSSPropertyPaddingLeft, ApplyPropertyLength<&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding>::createHandler());
 2170 setPropertyHandler(CSSPropertyPaddingRight, ApplyPropertyLength<&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding>::createHandler());
 2171 setPropertyHandler(CSSPropertyPaddingTop, ApplyPropertyLength<&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding>::createHandler());
 2172 setPropertyHandler(CSSPropertyPageBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakAfter, EPageBreak, &RenderStyle::setPageBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2173 setPropertyHandler(CSSPropertyPageBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakBefore, EPageBreak, &RenderStyle::setPageBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2174 setPropertyHandler(CSSPropertyPageBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakInside, EPageBreak, &RenderStyle::setPageBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2175 setPropertyHandler(CSSPropertyPointerEvents, ApplyPropertyDefault<EPointerEvents, &RenderStyle::pointerEvents, EPointerEvents, &RenderStyle::setPointerEvents, EPointerEvents, &RenderStyle::initialPointerEvents>::createHandler());
 2176 setPropertyHandler(CSSPropertyPosition, ApplyPropertyDefault<EPosition, &RenderStyle::position, EPosition, &RenderStyle::setPosition, EPosition, &RenderStyle::initialPosition>::createHandler());
 2177 setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
 2178 setPropertyHandler(CSSPropertyRight, ApplyPropertyLength<&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
 2179 setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler());
 2180 setPropertyHandler(CSSPropertySpeak, ApplyPropertyDefault<ESpeak, &RenderStyle::speak, ESpeak, &RenderStyle::setSpeak, ESpeak, &RenderStyle::initialSpeak>::createHandler());
 2181 setPropertyHandler(CSSPropertyTableLayout, ApplyPropertyDefault<ETableLayout, &RenderStyle::tableLayout, ETableLayout, &RenderStyle::setTableLayout, ETableLayout, &RenderStyle::initialTableLayout>::createHandler());
 2182 setPropertyHandler(CSSPropertyTabSize, ApplyPropertyDefault<unsigned, &RenderStyle::tabSize, unsigned, &RenderStyle::setTabSize, unsigned, &RenderStyle::initialTabSize>::createHandler());
 2183 setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
 2184 setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler());
 2185#if ENABLE(CSS3_TEXT)
 2186 setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler());
 2187 setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault<TextDecorationStyle, &RenderStyle::textDecorationStyle, TextDecorationStyle, &RenderStyle::setTextDecorationStyle, TextDecorationStyle, &RenderStyle::initialTextDecorationStyle>::createHandler());
 2188 setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
 2189 setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<TextAlignLast, &RenderStyle::textAlignLast, TextAlignLast, &RenderStyle::setTextAlignLast, TextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler());
 2190 setPropertyHandler(CSSPropertyWebkitTextJustify, ApplyPropertyDefault<TextJustify, &RenderStyle::textJustify, TextJustify, &RenderStyle::setTextJustify, TextJustify, &RenderStyle::initialTextJustify>::createHandler());
 2191 setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
 2192#endif // CSS3_TEXT
 2193 setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyTextIndent::createHandler());
 2194 setPropertyHandler(CSSPropertyTextOverflow, ApplyPropertyDefault<TextOverflow, &RenderStyle::textOverflow, TextOverflow, &RenderStyle::setTextOverflow, TextOverflow, &RenderStyle::initialTextOverflow>::createHandler());
 2195 setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
 2196 setPropertyHandler(CSSPropertyTextTransform, ApplyPropertyDefault<ETextTransform, &RenderStyle::textTransform, ETextTransform, &RenderStyle::setTextTransform, ETextTransform, &RenderStyle::initialTextTransform>::createHandler());
 2197 setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
 2198 setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyDefault<EUnicodeBidi, &RenderStyle::unicodeBidi, EUnicodeBidi, &RenderStyle::setUnicodeBidi, EUnicodeBidi, &RenderStyle::initialUnicodeBidi>::createHandler());
 2199 setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
 2200 setPropertyHandler(CSSPropertyVisibility, ApplyPropertyDefault<EVisibility, &RenderStyle::visibility, EVisibility, &RenderStyle::setVisibility, EVisibility, &RenderStyle::initialVisibility>::createHandler());
 2201 setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
 2202 setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation<Animation::AnimationDirection, &Animation::direction, &Animation::setDirection, &Animation::isDirectionSet, &Animation::clearDirection, &Animation::initialAnimationDirection, &CSSToStyleMap::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
 2203 setPropertyHandler(CSSPropertyWebkitAnimationDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
 2204 setPropertyHandler(CSSPropertyWebkitAnimationFillMode, ApplyPropertyAnimation<unsigned, &Animation::fillMode, &Animation::setFillMode, &Animation::isFillModeSet, &Animation::clearFillMode, &Animation::initialAnimationFillMode, &CSSToStyleMap::mapAnimationFillMode, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
 2205 setPropertyHandler(CSSPropertyWebkitAnimationIterationCount, ApplyPropertyAnimation<double, &Animation::iterationCount, &Animation::setIterationCount, &Animation::isIterationCountSet, &Animation::clearIterationCount, &Animation::initialAnimationIterationCount, &CSSToStyleMap::mapAnimationIterationCount, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
 2206 setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation<const String&, &Animation::name, &Animation::setName, &Animation::isNameSet, &Animation::clearName, &Animation::initialAnimationName, &CSSToStyleMap::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
 2207 setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation<EAnimPlayState, &Animation::playState, &Animation::setPlayState, &Animation::isPlayStateSet, &Animation::clearPlayState, &Animation::initialAnimationPlayState, &CSSToStyleMap::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
 2208 setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
 2209 setPropertyHandler(CSSPropertyWebkitAppearance, ApplyPropertyDefault<ControlPart, &RenderStyle::appearance, ControlPart, &RenderStyle::setAppearance, ControlPart, &RenderStyle::initialAppearance>::createHandler());
 2210 setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler());
 2211 setPropertyHandler(CSSPropertyWebkitBackfaceVisibility, ApplyPropertyDefault<EBackfaceVisibility, &RenderStyle::backfaceVisibility, EBackfaceVisibility, &RenderStyle::setBackfaceVisibility, EBackfaceVisibility, &RenderStyle::initialBackfaceVisibility>::createHandler());
 2212 setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
 2213 setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
 2214 setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
 2215 setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
 2216#if ENABLE(CSS_COMPOSITING)
 2217 setPropertyHandler(CSSPropertyWebkitBlendMode, ApplyPropertyDefault<BlendMode, &RenderStyle::blendMode, BlendMode, &RenderStyle::setBlendMode, BlendMode, &RenderStyle::initialBlendMode>::createHandler());
 2218 setPropertyHandler(CSSPropertyWebkitBackgroundBlendMode, ApplyPropertyFillLayer<BlendMode, CSSPropertyWebkitBackgroundBlendMode, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isBlendModeSet, &FillLayer::blendMode, &FillLayer::setBlendMode, &FillLayer::clearBlendMode, &FillLayer::initialFillBlendMode, &CSSToStyleMap::mapFillBlendMode>::createHandler());
 2219#endif
 2220 setPropertyHandler(CSSPropertyWebkitBorderFit, ApplyPropertyDefault<EBorderFit, &RenderStyle::borderFit, EBorderFit, &RenderStyle::setBorderFit, EBorderFit, &RenderStyle::initialBorderFit>::createHandler());
 2221 setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing>::createHandler());
 2222 setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage<BorderImage, CSSPropertyWebkitBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage>::createHandler());
 2223 setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing>::createHandler());
 2224 setPropertyHandler(CSSPropertyWebkitBoxAlign, ApplyPropertyDefault<EBoxAlignment, &RenderStyle::boxAlign, EBoxAlignment, &RenderStyle::setBoxAlign, EBoxAlignment, &RenderStyle::initialBoxAlign>::createHandler());
 2225#if ENABLE(CSS_BOX_DECORATION_BREAK)
 2226 setPropertyHandler(CSSPropertyWebkitBoxDecorationBreak, ApplyPropertyDefault<EBoxDecorationBreak, &RenderStyle::boxDecorationBreak, EBoxDecorationBreak, &RenderStyle::setBoxDecorationBreak, EBoxDecorationBreak, &RenderStyle::initialBoxDecorationBreak>::createHandler());
 2227#endif
 2228 setPropertyHandler(CSSPropertyWebkitBoxDirection, ApplyPropertyDefault<EBoxDirection, &RenderStyle::boxDirection, EBoxDirection, &RenderStyle::setBoxDirection, EBoxDirection, &RenderStyle::initialBoxDirection>::createHandler());
 2229 setPropertyHandler(CSSPropertyWebkitBoxFlex, ApplyPropertyDefault<float, &RenderStyle::boxFlex, float, &RenderStyle::setBoxFlex, float, &RenderStyle::initialBoxFlex>::createHandler());
 2230 setPropertyHandler(CSSPropertyWebkitBoxFlexGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxFlexGroup, unsigned int, &RenderStyle::setBoxFlexGroup, unsigned int, &RenderStyle::initialBoxFlexGroup>::createHandler());
 2231 setPropertyHandler(CSSPropertyWebkitBoxLines, ApplyPropertyDefault<EBoxLines, &RenderStyle::boxLines, EBoxLines, &RenderStyle::setBoxLines, EBoxLines, &RenderStyle::initialBoxLines>::createHandler());
 2232 setPropertyHandler(CSSPropertyWebkitBoxOrdinalGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxOrdinalGroup, unsigned int, &RenderStyle::setBoxOrdinalGroup, unsigned int, &RenderStyle::initialBoxOrdinalGroup>::createHandler());
 2233 setPropertyHandler(CSSPropertyWebkitBoxOrient, ApplyPropertyDefault<EBoxOrient, &RenderStyle::boxOrient, EBoxOrient, &RenderStyle::setBoxOrient, EBoxOrient, &RenderStyle::initialBoxOrient>::createHandler());
 2234 setPropertyHandler(CSSPropertyWebkitBoxPack, ApplyPropertyDefault<EBoxPack, &RenderStyle::boxPack, EBoxPack, &RenderStyle::setBoxPack, EBoxPack, &RenderStyle::initialBoxPack>::createHandler());
 2235 setPropertyHandler(CSSPropertyWebkitColorCorrection, ApplyPropertyDefault<ColorSpace, &RenderStyle::colorSpace, ColorSpace, &RenderStyle::setColorSpace, ColorSpace, &RenderStyle::initialColorSpace>::createHandler());
 2236 setPropertyHandler(CSSPropertyWebkitColumnAxis, ApplyPropertyDefault<ColumnAxis, &RenderStyle::columnAxis, ColumnAxis, &RenderStyle::setColumnAxis, ColumnAxis, &RenderStyle::initialColumnAxis>::createHandler());
 2237 setPropertyHandler(CSSPropertyWebkitColumnBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakAfter, EPageBreak, &RenderStyle::setColumnBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2238 setPropertyHandler(CSSPropertyWebkitColumnBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakBefore, EPageBreak, &RenderStyle::setColumnBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2239 setPropertyHandler(CSSPropertyWebkitColumnBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakInside, EPageBreak, &RenderStyle::setColumnBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2240 setPropertyHandler(CSSPropertyWebkitColumnCount, ApplyPropertyAuto<unsigned short, &RenderStyle::columnCount, &RenderStyle::setColumnCount, &RenderStyle::hasAutoColumnCount, &RenderStyle::setHasAutoColumnCount>::createHandler());
 2241 setPropertyHandler(CSSPropertyWebkitColumnGap, ApplyPropertyAuto<float, &RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap, ComputeLength, CSSValueNormal>::createHandler());
 2242 setPropertyHandler(CSSPropertyWebkitColumnProgression, ApplyPropertyDefault<ColumnProgression, &RenderStyle::columnProgression, ColumnProgression, &RenderStyle::setColumnProgression, ColumnProgression, &RenderStyle::initialColumnProgression>::createHandler());
 2243 setPropertyHandler(CSSPropertyWebkitColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
 2244 setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialColumnRuleWidth, NormalDisabled, ThicknessEnabled>::createHandler());
 2245 setPropertyHandler(CSSPropertyWebkitColumnSpan, ApplyPropertyDefault<ColumnSpan, &RenderStyle::columnSpan, ColumnSpan, &RenderStyle::setColumnSpan, ColumnSpan, &RenderStyle::initialColumnSpan>::createHandler());
 2246 setPropertyHandler(CSSPropertyWebkitColumnRuleStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::columnRuleStyle, EBorderStyle, &RenderStyle::setColumnRuleStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
 2247 setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
 2248#if ENABLE(CURSOR_VISIBILITY)
 2249 setPropertyHandler(CSSPropertyWebkitCursorVisibility, ApplyPropertyDefault<CursorVisibility, &RenderStyle::cursorVisibility, CursorVisibility, &RenderStyle::setCursorVisibility, CursorVisibility, &RenderStyle::initialCursorVisibility>::createHandler());
 2250#endif
 2251 setPropertyHandler(CSSPropertyWebkitAlignContent, ApplyPropertyDefault<EAlignContent, &RenderStyle::alignContent, EAlignContent, &RenderStyle::setAlignContent, EAlignContent, &RenderStyle::initialAlignContent>::createHandler());
 2252 setPropertyHandler(CSSPropertyWebkitAlignItems, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignItems, EAlignItems, &RenderStyle::setAlignItems, EAlignItems, &RenderStyle::initialAlignItems>::createHandler());
 2253 setPropertyHandler(CSSPropertyWebkitAlignSelf, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignSelf, EAlignItems, &RenderStyle::setAlignSelf, EAlignItems, &RenderStyle::initialAlignSelf>::createHandler());
 2254 setPropertyHandler(CSSPropertyWebkitFlexBasis, ApplyPropertyLength<&RenderStyle::flexBasis, &RenderStyle::setFlexBasis, &RenderStyle::initialFlexBasis, AutoEnabled>::createHandler());
 2255 setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler());
 2256 setPropertyHandler(CSSPropertyWebkitFlexGrow, ApplyPropertyDefault<float, &RenderStyle::flexGrow, float, &RenderStyle::setFlexGrow, float, &RenderStyle::initialFlexGrow>::createHandler());
 2257 setPropertyHandler(CSSPropertyWebkitFlexShrink, ApplyPropertyDefault<float, &RenderStyle::flexShrink, float, &RenderStyle::setFlexShrink, float, &RenderStyle::initialFlexShrink>::createHandler());
 2258 setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler());
 2259 setPropertyHandler(CSSPropertyWebkitGridAutoFlow, ApplyPropertyDefault<GridAutoFlow, &RenderStyle::gridAutoFlow, GridAutoFlow, &RenderStyle::setGridAutoFlow, GridAutoFlow, &RenderStyle::initialGridAutoFlow>::createHandler());
 2260 setPropertyHandler(CSSPropertyWebkitJustifyContent, ApplyPropertyDefault<EJustifyContent, &RenderStyle::justifyContent, EJustifyContent, &RenderStyle::setJustifyContent, EJustifyContent, &RenderStyle::initialJustifyContent>::createHandler());
 2261 setPropertyHandler(CSSPropertyWebkitOrder, ApplyPropertyDefault<int, &RenderStyle::order, int, &RenderStyle::setOrder, int, &RenderStyle::initialOrder>::createHandler());
 2262#if ENABLE(CSS_REGIONS)
 2263 setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler());
 2264 setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapNoneToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler());
 2265#endif
 2266 setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
 2267 setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
 2268 setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
 2269 setPropertyHandler(CSSPropertyWebkitHighlight, ApplyPropertyString<MapNoneToNull, &RenderStyle::highlight, &RenderStyle::setHighlight, &RenderStyle::initialHighlight>::createHandler());
 2270 setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, ApplyPropertyString<MapAutoToNull, &RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString>::createHandler());
 2271 setPropertyHandler(CSSPropertyWebkitHyphenateLimitAfter, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitAfter, &RenderStyle::setHyphenationLimitAfter, &RenderStyle::initialHyphenationLimitAfter>::createHandler());
 2272 setPropertyHandler(CSSPropertyWebkitHyphenateLimitBefore, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitBefore, &RenderStyle::setHyphenationLimitBefore, &RenderStyle::initialHyphenationLimitBefore>::createHandler());
 2273 setPropertyHandler(CSSPropertyWebkitHyphenateLimitLines, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitLines, &RenderStyle::setHyphenationLimitLines, &RenderStyle::initialHyphenationLimitLines, CSSValueNoLimit>::createHandler());
 2274 setPropertyHandler(CSSPropertyWebkitHyphens, ApplyPropertyDefault<Hyphens, &RenderStyle::hyphens, Hyphens, &RenderStyle::setHyphens, Hyphens, &RenderStyle::initialHyphens>::createHandler());
 2275 setPropertyHandler(CSSPropertyWebkitLineAlign, ApplyPropertyDefault<LineAlign, &RenderStyle::lineAlign, LineAlign, &RenderStyle::setLineAlign, LineAlign, &RenderStyle::initialLineAlign>::createHandler());
 2276 setPropertyHandler(CSSPropertyWebkitLineBreak, ApplyPropertyDefault<LineBreak, &RenderStyle::lineBreak, LineBreak, &RenderStyle::setLineBreak, LineBreak, &RenderStyle::initialLineBreak>::createHandler());
 2277 setPropertyHandler(CSSPropertyWebkitLineClamp, ApplyPropertyDefault<const LineClampValue&, &RenderStyle::lineClamp, LineClampValue, &RenderStyle::setLineClamp, LineClampValue, &RenderStyle::initialLineClamp>::createHandler());
 2278 setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString<MapNoneToNull, &RenderStyle::lineGrid, &RenderStyle::setLineGrid, &RenderStyle::initialLineGrid>::createHandler());
 2279 setPropertyHandler(CSSPropertyWebkitLineSnap, ApplyPropertyDefault<LineSnap, &RenderStyle::lineSnap, LineSnap, &RenderStyle::setLineSnap, LineSnap, &RenderStyle::initialLineSnap>::createHandler());
 2280 setPropertyHandler(CSSPropertyWebkitMarginAfterCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginAfterCollapse, EMarginCollapse, &RenderStyle::setMarginAfterCollapse, EMarginCollapse, &RenderStyle::initialMarginAfterCollapse>::createHandler());
 2281 setPropertyHandler(CSSPropertyWebkitMarginBeforeCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginBeforeCollapse, EMarginCollapse, &RenderStyle::setMarginBeforeCollapse, EMarginCollapse, &RenderStyle::initialMarginBeforeCollapse>::createHandler());
 2282 setPropertyHandler(CSSPropertyWebkitMarginBottomCollapse, CSSPropertyWebkitMarginAfterCollapse);
 2283 setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse);
 2284 setPropertyHandler(CSSPropertyWebkitMarqueeDirection, ApplyPropertyDefault<EMarqueeDirection, &RenderStyle::marqueeDirection, EMarqueeDirection, &RenderStyle::setMarqueeDirection, EMarqueeDirection, &RenderStyle::initialMarqueeDirection>::createHandler());
 2285 setPropertyHandler(CSSPropertyWebkitMarqueeIncrement, ApplyPropertyMarqueeIncrement::createHandler());
 2286 setPropertyHandler(CSSPropertyWebkitMarqueeRepetition, ApplyPropertyMarqueeRepetition::createHandler());
 2287 setPropertyHandler(CSSPropertyWebkitMarqueeSpeed, ApplyPropertyMarqueeSpeed::createHandler());
 2288 setPropertyHandler(CSSPropertyWebkitMarqueeStyle, ApplyPropertyDefault<EMarqueeBehavior, &RenderStyle::marqueeBehavior, EMarqueeBehavior, &RenderStyle::setMarqueeBehavior, EMarqueeBehavior, &RenderStyle::initialMarqueeBehavior>::createHandler());
 2289 setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage<BorderMask, CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage>::createHandler());
 2290 setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier<BorderMask, Outset>::createHandler());
 2291 setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier<BorderMask, Repeat>::createHandler());
 2292 setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier<BorderMask, Slice>::createHandler());
 2293 setPropertyHandler(CSSPropertyWebkitMaskBoxImageSource, ApplyPropertyBorderImageSource<CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource, &RenderStyle::initialMaskBoxImageSource>::createHandler());
 2294 setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier<BorderMask, Width>::createHandler());
 2295 setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSToStyleMap::mapFillClip>::createHandler());
 2296 setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
 2297 setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSToStyleMap::mapFillImage>::createHandler());
 2298 setPropertyHandler(CSSPropertyWebkitMaskOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSToStyleMap::mapFillOrigin>::createHandler());
 2299 setPropertyHandler(CSSPropertyWebkitMaskPositionX, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSToStyleMap::mapFillXPosition>::createHandler());
 2300 setPropertyHandler(CSSPropertyWebkitMaskPositionY, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSToStyleMap::mapFillYPosition>::createHandler());
 2301 setPropertyHandler(CSSPropertyWebkitMaskRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSToStyleMap::mapFillRepeatX>::createHandler());
 2302 setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler());
 2303 setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
 2304 setPropertyHandler(CSSPropertyWebkitNbspMode, ApplyPropertyDefault<ENBSPMode, &RenderStyle::nbspMode, ENBSPMode, &RenderStyle::setNBSPMode, ENBSPMode, &RenderStyle::initialNBSPMode>::createHandler());
 2305 setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
 2306 setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler());
 2307 setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, ApplyPropertyLength<&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY>::createHandler());
 2308 setPropertyHandler(CSSPropertyWebkitPrintColorAdjust, ApplyPropertyDefault<PrintColorAdjust, &RenderStyle::printColorAdjust, PrintColorAdjust, &RenderStyle::setPrintColorAdjust, PrintColorAdjust, &RenderStyle::initialPrintColorAdjust>::createHandler());
 2309#if ENABLE(CSS_REGIONS)
 2310 setPropertyHandler(CSSPropertyWebkitRegionBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakAfter, EPageBreak, &RenderStyle::setRegionBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2311 setPropertyHandler(CSSPropertyWebkitRegionBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakBefore, EPageBreak, &RenderStyle::setRegionBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2312 setPropertyHandler(CSSPropertyWebkitRegionBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakInside, EPageBreak, &RenderStyle::setRegionBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
 2313 setPropertyHandler(CSSPropertyWebkitRegionOverflow, ApplyPropertyDefault<RegionOverflow, &RenderStyle::regionOverflow, RegionOverflow, &RenderStyle::setRegionOverflow, RegionOverflow, &RenderStyle::initialRegionOverflow>::createHandler());
 2314#endif
 2315 setPropertyHandler(CSSPropertyWebkitRtlOrdering, ApplyPropertyDefault<Order, &RenderStyle::rtlOrdering, Order, &RenderStyle::setRTLOrdering, Order, &RenderStyle::initialRTLOrdering>::createHandler());
 2316 setPropertyHandler(CSSPropertyWebkitRubyPosition, ApplyPropertyDefault<RubyPosition, &RenderStyle::rubyPosition, RubyPosition, &RenderStyle::setRubyPosition, RubyPosition, &RenderStyle::initialRubyPosition>::createHandler());
 2317 setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault<TextCombine, &RenderStyle::textCombine, TextCombine, &RenderStyle::setTextCombine, TextCombine, &RenderStyle::initialTextCombine>::createHandler());
 2318 setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
 2319 setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyDefault<TextEmphasisPosition, &RenderStyle::textEmphasisPosition, TextEmphasisPosition, &RenderStyle::setTextEmphasisPosition, TextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition>::createHandler());
 2320 setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler());
 2321 setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler());
 2322 setPropertyHandler(CSSPropertyWebkitTextSecurity, ApplyPropertyDefault<ETextSecurity, &RenderStyle::textSecurity, ETextSecurity, &RenderStyle::setTextSecurity, ETextSecurity, &RenderStyle::initialTextSecurity>::createHandler());
 2323 setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color>::createHandler());
 2324 setPropertyHandler(CSSPropertyWebkitTransformOriginX, ApplyPropertyLength<&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX>::createHandler());
 2325 setPropertyHandler(CSSPropertyWebkitTransformOriginY, ApplyPropertyLength<&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY>::createHandler());
 2326 setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength<float, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ>::createHandler());
 2327 setPropertyHandler(CSSPropertyWebkitTransformStyle, ApplyPropertyDefault<ETransformStyle3D, &RenderStyle::transformStyle3D, ETransformStyle3D, &RenderStyle::setTransformStyle3D, ETransformStyle3D, &RenderStyle::initialTransformStyle3D>::createHandler());
 2328 setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
 2329 setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
 2330 setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation<CSSPropertyID, &Animation::property, &Animation::setProperty, &Animation::isPropertySet, &Animation::clearProperty, &Animation::initialAnimationProperty, &CSSToStyleMap::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
 2331 setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
 2332 setPropertyHandler(CSSPropertyWebkitUserDrag, ApplyPropertyDefault<EUserDrag, &RenderStyle::userDrag, EUserDrag, &RenderStyle::setUserDrag, EUserDrag, &RenderStyle::initialUserDrag>::createHandler());
 2333 setPropertyHandler(CSSPropertyWebkitUserModify, ApplyPropertyDefault<EUserModify, &RenderStyle::userModify, EUserModify, &RenderStyle::setUserModify, EUserModify, &RenderStyle::initialUserModify>::createHandler());
 2334 setPropertyHandler(CSSPropertyWebkitUserSelect, ApplyPropertyDefault<EUserSelect, &RenderStyle::userSelect, EUserSelect, &RenderStyle::setUserSelect, EUserSelect, &RenderStyle::initialUserSelect>::createHandler());
 2335 setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderStyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::createHandler());
 2336
 2337#if ENABLE(CSS_EXCLUSIONS)
 2338 setPropertyHandler(CSSPropertyWebkitWrapFlow, ApplyPropertyDefault<WrapFlow, &RenderStyle::wrapFlow, WrapFlow, &RenderStyle::setWrapFlow, WrapFlow, &RenderStyle::initialWrapFlow>::createHandler());
 2339 setPropertyHandler(CSSPropertyWebkitShapeMargin, ApplyPropertyLength<&RenderStyle::shapeMargin, &RenderStyle::setShapeMargin, &RenderStyle::initialShapeMargin>::createHandler());
 2340 setPropertyHandler(CSSPropertyWebkitShapePadding, ApplyPropertyLength<&RenderStyle::shapePadding, &RenderStyle::setShapePadding, &RenderStyle::initialShapePadding>::createHandler());
 2341 setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault<WrapThrough, &RenderStyle::wrapThrough, WrapThrough, &RenderStyle::setWrapThrough, WrapThrough, &RenderStyle::initialWrapThrough>::createHandler());
 2342 setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyExclusionShape<&RenderStyle::shapeInside, &RenderStyle::setShapeInside, &RenderStyle::initialShapeInside>::createHandler());
 2343 setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyExclusionShape<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initialShapeOutside>::createHandler());
 2344#endif
 2345 setPropertyHandler(CSSPropertyWhiteSpace, ApplyPropertyDefault<EWhiteSpace, &RenderStyle::whiteSpace, EWhiteSpace, &RenderStyle::setWhiteSpace, EWhiteSpace, &RenderStyle::initialWhiteSpace>::createHandler());
 2346 setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
 2347 setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
 2348 setPropertyHandler(CSSPropertyWordBreak, ApplyPropertyDefault<EWordBreak, &RenderStyle::wordBreak, EWordBreak, &RenderStyle::setWordBreak, EWordBreak, &RenderStyle::initialWordBreak>::createHandler());
 2349 setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
 2350 // UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
 2351 setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
 2352 setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
 2353 setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
 2354}
 2355
 2356
 2357}

Source/WebCore/css/DeprecatedStyleBuilder.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 23 */
 24
 25#ifndef DeprecatedStyleBuilder_h
 26#define DeprecatedStyleBuilder_h
 27
 28#include "CSSPropertyNames.h"
 29#include "StylePropertyShorthand.h"
 30#include <wtf/PassRefPtr.h>
 31#include <wtf/RefCounted.h>
 32
 33namespace WebCore {
 34
 35class CSSValue;
 36class DeprecatedStyleBuilder;
 37class StyleResolver;
 38
 39class PropertyHandler {
 40public:
 41 typedef void (*InheritFunction)(CSSPropertyID, StyleResolver*);
 42 typedef void (*InitialFunction)(CSSPropertyID, StyleResolver*);
 43 typedef void (*ApplyFunction)(CSSPropertyID, StyleResolver*, CSSValue*);
 44 PropertyHandler() : m_inherit(0), m_initial(0), m_apply(0) { }
 45 PropertyHandler(InheritFunction inherit, InitialFunction initial, ApplyFunction apply) : m_inherit(inherit), m_initial(initial), m_apply(apply) { }
 46 void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) const { ASSERT(m_inherit); (*m_inherit)(propertyID, styleResolver); }
 47 void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) const { ASSERT(m_initial); (*m_initial)(propertyID, styleResolver); }
 48 void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) const { ASSERT(m_apply); (*m_apply)(propertyID, styleResolver, value); }
 49 bool isValid() const { return m_inherit && m_initial && m_apply; }
 50 InheritFunction inheritFunction() const { return m_inherit; }
 51 InitialFunction initialFunction() { return m_initial; }
 52 ApplyFunction applyFunction() { return m_apply; }
 53private:
 54 InheritFunction m_inherit;
 55 InitialFunction m_initial;
 56 ApplyFunction m_apply;
 57};
 58
 59class DeprecatedStyleBuilder {
 60 WTF_MAKE_NONCOPYABLE(DeprecatedStyleBuilder); WTF_MAKE_FAST_ALLOCATED;
 61public:
 62 static const DeprecatedStyleBuilder& sharedStyleBuilder();
 63
 64 const PropertyHandler& propertyHandler(CSSPropertyID property) const
 65 {
 66 ASSERT(valid(property));
 67 return m_propertyMap[index(property)];
 68 }
 69private:
 70 DeprecatedStyleBuilder();
 71 static int index(CSSPropertyID property)
 72 {
 73 return property - firstCSSProperty;
 74 }
 75
 76 static bool valid(CSSPropertyID property)
 77 {
 78 int i = index(property);
 79 return i >= 0 && i < numCSSProperties;
 80 }
 81
 82 void setPropertyHandler(CSSPropertyID property, const PropertyHandler& handler)
 83 {
 84 ASSERT(valid(property));
 85 ASSERT(!propertyHandler(property).isValid());
 86 ASSERT_WITH_MESSAGE(!isExpandedShorthand(property), "Shorthand property id = %d shouldn't be inserted into StyleBuilder. Shorthands should be expanded at parsing time.", property);
 87 m_propertyMap[index(property)] = handler;
 88 }
 89
 90 void setPropertyHandler(CSSPropertyID newProperty, CSSPropertyID equivalentProperty)
 91 {
 92 ASSERT(valid(newProperty));
 93 ASSERT(valid(equivalentProperty));
 94 ASSERT(!propertyHandler(newProperty).isValid());
 95 ASSERT_WITH_MESSAGE(!isExpandedShorthand(newProperty), "Shorthand property id = %d shouldn't be inserted into StyleBuilder. Shorthands should be expanded at parsing time.", newProperty);
 96 ASSERT_WITH_MESSAGE(!isExpandedShorthand(equivalentProperty), "Shorthand property id = %d shouldn't be inserted into StyleBuilder. Shorthands should be expanded at parsing time.", equivalentProperty);
 97 m_propertyMap[index(newProperty)] = m_propertyMap[index(equivalentProperty)];
 98 }
 99
 100 PropertyHandler m_propertyMap[numCSSProperties];
 101};
 102
 103}
 104
 105#endif // DeprecatedStyleBuilder_h

Source/WebCore/css/StyleBuilder.cpp

1 /*
2  * Copyright (C) 2011 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16  * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24 
25 #include "config.h"
26 #include "StyleBuilder.h"
27 
28 #include "BasicShapeFunctions.h"
29 #include "BasicShapes.h"
30 #include "CSSAspectRatioValue.h"
31 #include "CSSCalculationValue.h"
32 #include "CSSCursorImageValue.h"
33 #include "CSSPrimitiveValueMappings.h"
34 #include "CSSToStyleMap.h"
35 #include "CSSValueList.h"
36 #include "ClipPathOperation.h"
37 #include "CursorList.h"
38 #include "Document.h"
39 #include "Element.h"
40 #include "Pair.h"
41 #include "Rect.h"
42 #include "RenderObject.h"
43 #include "RenderStyle.h"
44 #include "RenderView.h"
45 #include "Settings.h"
46 #include "StyleResolver.h"
47 #include <wtf/StdLibExtras.h>
48 #include <wtf/UnusedParam.h>
49 
50 #if ENABLE(CSS_EXCLUSIONS)
51 #include "ExclusionShapeValue.h"
52 #endif
53 
54 using namespace std;
55 
56 namespace WebCore {
57 
58 enum ExpandValueBehavior {SuppressValue = 0, ExpandValue};
59 template <ExpandValueBehavior expandValue, CSSPropertyID one = CSSPropertyInvalid, CSSPropertyID two = CSSPropertyInvalid, CSSPropertyID three = CSSPropertyInvalid, CSSPropertyID four = CSSPropertyInvalid, CSSPropertyID five = CSSPropertyInvalid>
60 class ApplyPropertyExpanding {
61 public:
62 
63  template <CSSPropertyID id>
64  static inline void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
65  {
66  if (id == CSSPropertyInvalid)
67  return;
68 
69  const StyleBuilder& table = StyleBuilder::sharedStyleBuilder();
70  const PropertyHandler& handler = table.propertyHandler(id);
71  if (handler.isValid())
72  handler.applyInheritValue(propertyID, styleResolver);
73  }
74 
75  static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
76  {
77  applyInheritValue<one>(propertyID, styleResolver);
78  applyInheritValue<two>(propertyID, styleResolver);
79  applyInheritValue<three>(propertyID, styleResolver);
80  applyInheritValue<four>(propertyID, styleResolver);
81  applyInheritValue<five>(propertyID, styleResolver);
82  }
83 
84  template <CSSPropertyID id>
85  static inline void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
86  {
87  if (id == CSSPropertyInvalid)
88  return;
89 
90  const StyleBuilder& table = StyleBuilder::sharedStyleBuilder();
91  const PropertyHandler& handler = table.propertyHandler(id);
92  if (handler.isValid())
93  handler.applyInitialValue(propertyID, styleResolver);
94  }
95 
96  static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
97  {
98  applyInitialValue<one>(propertyID, styleResolver);
99  applyInitialValue<two>(propertyID, styleResolver);
100  applyInitialValue<three>(propertyID, styleResolver);
101  applyInitialValue<four>(propertyID, styleResolver);
102  applyInitialValue<five>(propertyID, styleResolver);
103  }
104 
105  template <CSSPropertyID id>
106  static inline void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
107  {
108  if (id == CSSPropertyInvalid)
109  return;
110 
111  const StyleBuilder& table = StyleBuilder::sharedStyleBuilder();
112  const PropertyHandler& handler = table.propertyHandler(id);
113  if (handler.isValid())
114  handler.applyValue(propertyID, styleResolver, value);
115  }
116 
117  static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
118  {
119  if (!expandValue)
120  return;
121 
122  applyValue<one>(propertyID, styleResolver, value);
123  applyValue<two>(propertyID, styleResolver, value);
124  applyValue<three>(propertyID, styleResolver, value);
125  applyValue<four>(propertyID, styleResolver, value);
126  applyValue<five>(propertyID, styleResolver, value);
127  }
128  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
129 };
130 
131 template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
132 class ApplyPropertyDefaultBase {
133 public:
134  static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
135  static GetterType value(RenderStyle* style) { return (style->*getterFunction)(); }
136  static InitialType initial() { return (*initialFunction)(); }
137  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), value(styleResolver->parentStyle())); }
138  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), initial()); }
139  static void applyValue(CSSPropertyID, StyleResolver*, CSSValue*) { }
140  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
141 };
142 
143 template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
144 class ApplyPropertyDefault {
145 public:
146  static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
147  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
148  {
149  if (value->isPrimitiveValue())
150  setValue(styleResolver->style(), *static_cast<CSSPrimitiveValue*>(value));
151  }
152  static PropertyHandler createHandler()
153  {
154  PropertyHandler handler = ApplyPropertyDefaultBase<GetterType, getterFunction, SetterType, setterFunction, InitialType, initialFunction>::createHandler();
155  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
156  }
157 };
158 
159 template <typename NumberType, NumberType (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(NumberType), NumberType (*initialFunction)(), int idMapsToMinusOne = CSSValueAuto>
160 class ApplyPropertyNumber {
161 public:
162  static void setValue(RenderStyle* style, NumberType value) { (style->*setterFunction)(value); }
163  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
164  {
165  if (!value->isPrimitiveValue())
166  return;
167 
168  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
169  if (primitiveValue->getIdent() == idMapsToMinusOne)
170  setValue(styleResolver->style(), -1);
171  else
172  setValue(styleResolver->style(), primitiveValue->getValue<NumberType>(CSSPrimitiveValue::CSS_NUMBER));
173  }
174  static PropertyHandler createHandler()
175  {
176  PropertyHandler handler = ApplyPropertyDefaultBase<NumberType, getterFunction, NumberType, setterFunction, NumberType, initialFunction>::createHandler();
177  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
178  }
179 };
180 
181 template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSSPropertyID property>
182 class ApplyPropertyStyleImage {
183 public:
184  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(property, value)); }
185  static PropertyHandler createHandler()
186  {
187  PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
188  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
189  }
190 };
191 
192 enum AutoValueType {Number = 0, ComputeLength};
193 template <typename T, T (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(T), bool (RenderStyle::*hasAutoFunction)() const, void (RenderStyle::*setAutoFunction)(), AutoValueType valueType = Number, int autoIdentity = CSSValueAuto>
194 class ApplyPropertyAuto {
195 public:
196  static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
197  static T value(RenderStyle* style) { return (style->*getterFunction)(); }
198  static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)(); }
199  static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); }
200 
201  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
202  {
203  if (hasAuto(styleResolver->parentStyle()))
204  setAuto(styleResolver->style());
205  else
206  setValue(styleResolver->style(), value(styleResolver->parentStyle()));
207  }
208 
209  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setAuto(styleResolver->style()); }
210 
211  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
212  {
213  if (!value->isPrimitiveValue())
214  return;
215 
216  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
217  if (primitiveValue->getIdent() == autoIdentity)
218  setAuto(styleResolver->style());
219  else if (valueType == Number)
220  setValue(styleResolver->style(), *primitiveValue);
221  else if (valueType == ComputeLength)
222  setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
223  }
224 
225  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
226 };
227 
228 class ApplyPropertyClip {
229 private:
230  static Length convertToLength(StyleResolver* styleResolver, CSSPrimitiveValue* value)
231  {
232  return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
233  }
234 public:
235  static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
236  {
237  RenderStyle* parentStyle = styleResolver->parentStyle();
238  if (!parentStyle->hasClip())
239  return applyInitialValue(propertyID, styleResolver);
240  styleResolver->style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft());
241  styleResolver->style()->setHasClip(true);
242  }
243 
244  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
245  {
246  styleResolver->style()->setClip(Length(), Length(), Length(), Length());
247  styleResolver->style()->setHasClip(false);
248  }
249 
250  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
251  {
252  if (!value->isPrimitiveValue())
253  return;
254 
255  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
256 
257  if (Rect* rect = primitiveValue->getRectValue()) {
258  Length top = convertToLength(styleResolver, rect->top());
259  Length right = convertToLength(styleResolver, rect->right());
260  Length bottom = convertToLength(styleResolver, rect->bottom());
261  Length left = convertToLength(styleResolver, rect->left());
262  styleResolver->style()->setClip(top, right, bottom, left);
263  styleResolver->style()->setHasClip(true);
264  } else if (primitiveValue->getIdent() == CSSValueAuto) {
265  styleResolver->style()->setClip(Length(), Length(), Length(), Length());
266  styleResolver->style()->setHasClip(false);
267  }
268  }
269 
270  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
271 };
272 
273 enum ColorInherit {NoInheritFromParent = 0, InheritFromParent};
274 Color defaultInitialColor();
275 Color defaultInitialColor() { return Color(); }
276 template <ColorInherit inheritColorFromParent,
277  Color (RenderStyle::*getterFunction)() const,
278  void (RenderStyle::*setterFunction)(const Color&),
279  void (RenderStyle::*visitedLinkSetterFunction)(const Color&),
280  Color (RenderStyle::*defaultFunction)() const,
281  Color (*initialFunction)() = &defaultInitialColor>
282 class ApplyPropertyColor {
283 public:
284  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
285  {
286  // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
287  Color color = (styleResolver->parentStyle()->*getterFunction)();
288  applyColorValue(styleResolver, color.isValid() ? color : (styleResolver->parentStyle()->*defaultFunction)());
289  }
290 
291  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
292  {
293  applyColorValue(styleResolver, initialFunction());
294  }
295 
296  static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
297  {
298  if (!value->isPrimitiveValue())
299  return;
300 
301  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
302  if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
303  applyInheritValue(propertyID, styleResolver);
304  else {
305  if (styleResolver->applyPropertyToRegularStyle())
306  (styleResolver->style()->*setterFunction)(styleResolver->colorFromPrimitiveValue(primitiveValue));
307  if (styleResolver->applyPropertyToVisitedLinkStyle())
308  (styleResolver->style()->*visitedLinkSetterFunction)(styleResolver->colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true));
309  }
310  }
311 
312  static void applyColorValue(StyleResolver* styleResolver, const Color& color)
313  {
314  if (styleResolver->applyPropertyToRegularStyle())
315  (styleResolver->style()->*setterFunction)(color);
316  if (styleResolver->applyPropertyToVisitedLinkStyle())
317  (styleResolver->style()->*visitedLinkSetterFunction)(color);
318  }
319 
320  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
321 };
322 
323 template <TextDirection (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(TextDirection), TextDirection (*initialFunction)()>
324 class ApplyPropertyDirection {
325 public:
326  static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
327  {
328  ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(propertyID, styleResolver, value);
329  Element* element = styleResolver->element();
330  if (element && styleResolver->element() == element->document()->documentElement())
331  element->document()->setDirectionSetOnDocumentElement(true);
332  }
333 
334  static PropertyHandler createHandler()
335  {
336  PropertyHandler handler = ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::createHandler();
337  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
338  }
339 };
340 
341 enum LengthAuto { AutoDisabled = 0, AutoEnabled };
342 enum LengthLegacyIntrinsic { LegacyIntrinsicDisabled = 0, LegacyIntrinsicEnabled };
343 enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled };
344 enum LengthNone { NoneDisabled = 0, NoneEnabled };
345 enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled };
346 template <Length (RenderStyle::*getterFunction)() const,
347  void (RenderStyle::*setterFunction)(Length),
348  Length (*initialFunction)(),
349  LengthAuto autoEnabled = AutoDisabled,
350  LengthLegacyIntrinsic legacyIntrinsicEnabled = LegacyIntrinsicDisabled,
351  LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
352  LengthNone noneEnabled = NoneDisabled,
353  LengthUndefined noneUndefined = UndefinedDisabled>
354 class ApplyPropertyLength {
355 public:
356  static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); }
357  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
358  {
359  if (!value->isPrimitiveValue())
360  return;
361 
362  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
363  if (noneEnabled && primitiveValue->getIdent() == CSSValueNone) {
364  if (noneUndefined)
365  setValue(styleResolver->style(), Length(Undefined));
366  else
367  setValue(styleResolver->style(), Length());
368  }
369  if (legacyIntrinsicEnabled) {
370  if (primitiveValue->getIdent() == CSSValueIntrinsic)
371  setValue(styleResolver->style(), Length(Intrinsic));
372  else if (primitiveValue->getIdent() == CSSValueMinIntrinsic)
373  setValue(styleResolver->style(), Length(MinIntrinsic));
374  }
375  if (intrinsicEnabled) {
376  if (primitiveValue->getIdent() == CSSValueWebkitMinContent)
377  setValue(styleResolver->style(), Length(MinContent));
378  else if (primitiveValue->getIdent() == CSSValueWebkitMaxContent)
379  setValue(styleResolver->style(), Length(MaxContent));
380  else if (primitiveValue->getIdent() == CSSValueWebkitFillAvailable)
381  setValue(styleResolver->style(), Length(FillAvailable));
382  else if (primitiveValue->getIdent() == CSSValueWebkitFitContent)
383  setValue(styleResolver->style(), Length(FitContent));
384  }
385 
386  if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
387  setValue(styleResolver->style(), Length());
388  else if (primitiveValue->isLength()) {
389  Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
390  length.setQuirk(primitiveValue->isQuirkValue());
391  setValue(styleResolver->style(), length);
392  } else if (primitiveValue->isPercentage())
393  setValue(styleResolver->style(), Length(primitiveValue->getDoubleValue(), Percent));
394  else if (primitiveValue->isCalculatedPercentageWithLength())
395  setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
396  else if (primitiveValue->isViewportPercentageLength())
397  setValue(styleResolver->style(), primitiveValue->viewportPercentageLength());
398  }
399 
400  static PropertyHandler createHandler()
401  {
402  PropertyHandler handler = ApplyPropertyDefaultBase<Length, getterFunction, Length, setterFunction, Length, initialFunction>::createHandler();
403  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
404  }
405 };
406 
407 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull };
408 template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(const AtomicString&), const AtomicString& (*initialFunction)()>
409 class ApplyPropertyString {
410 public:
411  static void setValue(RenderStyle* style, const AtomicString& value) { (style->*setterFunction)(value); }
412  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
413  {
414  if (!value->isPrimitiveValue())
415  return;
416  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
417  if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSSValueNone)
418  || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto))
419  setValue(styleResolver->style(), nullAtom);
420  else
421  setValue(styleResolver->style(), primitiveValue->getStringValue());
422  }
423  static PropertyHandler createHandler()
424  {
425  PropertyHandler handler = ApplyPropertyDefaultBase<const AtomicString&, getterFunction, const AtomicString&, setterFunction, const AtomicString&, initialFunction>::createHandler();
426  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
427  }
428 };
429 
430 template <LengthSize (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
431 class ApplyPropertyBorderRadius {
432 public:
433  static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(value); }
434  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
435  {
436  if (!value->isPrimitiveValue())
437  return;
438 
439  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
440  Pair* pair = primitiveValue->getPairValue();
441  if (!pair || !pair->first() || !pair->second())
442  return;
443 
444  Length radiusWidth;
445  Length radiusHeight;
446  if (pair->first()->isPercentage())
447  radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
448  else if (pair->first()->isViewportPercentageLength())
449  radiusWidth = pair->first()->viewportPercentageLength();
450  else if (pair->first()->isCalculatedPercentageWithLength())
451  radiusWidth = Length((pair->first()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
452  else
453  radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
454  if (pair->second()->isPercentage())
455  radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
456  else if (pair->second()->isViewportPercentageLength())
457  radiusHeight = pair->second()->viewportPercentageLength();
458  else if (pair->second()->isCalculatedPercentageWithLength())
459  radiusHeight = Length((pair->second()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
460  else
461  radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
462  int width = radiusWidth.value();
463  int height = radiusHeight.value();
464  if (width < 0 || height < 0)
465  return;
466  if (!width)
467  radiusHeight = radiusWidth; // Null out the other value.
468  else if (!height)
469  radiusWidth = radiusHeight; // Null out the other value.
470 
471  LengthSize size(radiusWidth, radiusHeight);
472  setValue(styleResolver->style(), size);
473  }
474  static PropertyHandler createHandler()
475  {
476  PropertyHandler handler = ApplyPropertyDefaultBase<LengthSize, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
477  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
478  }
479 };
480 
481 template <typename T>
482 struct FillLayerAccessorTypes {
483  typedef T Setter;
484  typedef T Getter;
485 };
486 
487 template <>
488 struct FillLayerAccessorTypes<StyleImage*> {
489  typedef PassRefPtr<StyleImage> Setter;
490  typedef StyleImage* Getter;
491 };
492 
493 template <typename T,
494  CSSPropertyID propertyId,
495  EFillLayerType fillLayerType,
496  FillLayer* (RenderStyle::*accessLayersFunction)(),
497  const FillLayer* (RenderStyle::*layersFunction)() const,
498  bool (FillLayer::*testFunction)() const,
499  typename FillLayerAccessorTypes<T>::Getter (FillLayer::*getFunction)() const,
500  void (FillLayer::*setFunction)(typename FillLayerAccessorTypes<T>::Setter),
501  void (FillLayer::*clearFunction)(),
502  typename FillLayerAccessorTypes<T>::Getter (*initialFunction)(EFillLayerType),
503  void (CSSToStyleMap::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)>
504 class ApplyPropertyFillLayer {
505 public:
506  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
507  {
508  FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
509  FillLayer* prevChild = 0;
510  const FillLayer* currParent = (styleResolver->parentStyle()->*layersFunction)();
511  while (currParent && (currParent->*testFunction)()) {
512  if (!currChild) {
513  /* Need to make a new layer.*/
514  currChild = new FillLayer(fillLayerType);
515  prevChild->setNext(currChild);
516  }
517  (currChild->*setFunction)((currParent->*getFunction)());
518  prevChild = currChild;
519  currChild = prevChild->next();
520  currParent = currParent->next();
521  }
522 
523  while (currChild) {
524  /* Reset any remaining layers to not have the property set. */
525  (currChild->*clearFunction)();
526  currChild = currChild->next();
527  }
528  }
529 
530  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
531  {
532  FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
533  (currChild->*setFunction)((*initialFunction)(fillLayerType));
534  for (currChild = currChild->next(); currChild; currChild = currChild->next())
535  (currChild->*clearFunction)();
536  }
537 
538  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
539  {
540  FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
541  FillLayer* prevChild = 0;
542  if (value->isValueList()
543 #if ENABLE(CSS_IMAGE_SET)
544  && !value->isImageSetValue()
545 #endif
546  ) {
547  /* Walk each value and put it into a layer, creating new layers as needed. */
548  CSSValueList* valueList = static_cast<CSSValueList*>(value);
549  for (unsigned int i = 0; i < valueList->length(); i++) {
550  if (!currChild) {
551  /* Need to make a new layer to hold this value */
552  currChild = new FillLayer(fillLayerType);
553  prevChild->setNext(currChild);
554  }
555  (styleResolver->styleMap()->*mapFillFunction)(propertyId, currChild, valueList->itemWithoutBoundsCheck(i));
556  prevChild = currChild;
557  currChild = currChild->next();
558  }
559  } else {
560  (styleResolver->styleMap()->*mapFillFunction)(propertyId, currChild, value);
561  currChild = currChild->next();
562  }
563  while (currChild) {
564  /* Reset all remaining layers to not have the property set. */
565  (currChild->*clearFunction)();
566  currChild = currChild->next();
567  }
568  }
569 
570  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
571 };
572 
573 enum ComputeLengthNormal {NormalDisabled = 0, NormalEnabled};
574 enum ComputeLengthThickness {ThicknessDisabled = 0, ThicknessEnabled};
575 enum ComputeLengthSVGZoom {SVGZoomDisabled = 0, SVGZoomEnabled};
576 template <typename T,
577  T (RenderStyle::*getterFunction)() const,
578  void (RenderStyle::*setterFunction)(T),
579  T (*initialFunction)(),
580  ComputeLengthNormal normalEnabled = NormalDisabled,
581  ComputeLengthThickness thicknessEnabled = ThicknessDisabled,
582  ComputeLengthSVGZoom svgZoomEnabled = SVGZoomDisabled>
583 class ApplyPropertyComputeLength {
584 public:
585  static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
586  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
587  {
588  // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason...
589  if (!value->isPrimitiveValue())
590  return;
591 
592  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
593 
594  int ident = primitiveValue->getIdent();
595  T length;
596  if (normalEnabled && ident == CSSValueNormal) {
597  length = 0;
598  } else if (thicknessEnabled && ident == CSSValueThin) {
599  length = 1;
600  } else if (thicknessEnabled && ident == CSSValueMedium) {
601  length = 3;
602  } else if (thicknessEnabled && ident == CSSValueThick) {
603  length = 5;
604  } else if (ident == CSSValueInvalid) {
605  float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom();
606 
607  // Any original result that was >= 1 should not be allowed to fall below 1.
608  // This keeps border lines from vanishing.
609  length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), zoom);
610  if (zoom < 1.0f && length < 1.0) {
611  T originalLength = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), 1.0);
612  if (originalLength >= 1.0)
613  length = 1.0;
614  }
615 
616  } else {
617  ASSERT_NOT_REACHED();
618  length = 0;
619  }
620 
621  setValue(styleResolver->style(), length);
622  }
623  static PropertyHandler createHandler()
624  {
625  PropertyHandler handler = ApplyPropertyDefaultBase<T, getterFunction, T, setterFunction, T, initialFunction>::createHandler();
626  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
627  }
628 };
629 
630 template <typename T, T (FontDescription::*getterFunction)() const, void (FontDescription::*setterFunction)(T), T initialValue>
631 class ApplyPropertyFont {
632 public:
633  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
634  {
635  FontDescription fontDescription = styleResolver->fontDescription();
636  (fontDescription.*setterFunction)((styleResolver->parentFontDescription().*getterFunction)());
637  styleResolver->setFontDescription(fontDescription);
638  }
639 
640  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
641  {
642  FontDescription fontDescription = styleResolver->fontDescription();
643  (fontDescription.*setterFunction)(initialValue);
644  styleResolver->setFontDescription(fontDescription);
645  }
646 
647  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
648  {
649  if (!value->isPrimitiveValue())
650  return;
651  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
652  FontDescription fontDescription = styleResolver->fontDescription();
653  (fontDescription.*setterFunction)(*primitiveValue);
654  styleResolver->setFontDescription(fontDescription);
655  }
656 
657  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
658 };
659 
660 class ApplyPropertyFontFamily {
661 public:
662  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
663  {
664  FontDescription fontDescription = styleResolver->style()->fontDescription();
665  FontDescription parentFontDescription = styleResolver->parentStyle()->fontDescription();
666 
667  fontDescription.setGenericFamily(parentFontDescription.genericFamily());
668  fontDescription.setFamily(parentFontDescription.firstFamily());
669  fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());
670  styleResolver->setFontDescription(fontDescription);
671  return;
672  }
673 
674  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
675  {
676  FontDescription fontDescription = styleResolver->style()->fontDescription();
677  FontDescription initialDesc = FontDescription();
678 
679  // We need to adjust the size to account for the generic family change from monospace to non-monospace.
680  if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize())
681  styleResolver->setFontSize(fontDescription, styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, false));
682  fontDescription.setGenericFamily(initialDesc.genericFamily());
683  if (!initialDesc.firstFamily().familyIsEmpty())
684  fontDescription.setFamily(initialDesc.firstFamily());
685 
686  styleResolver->setFontDescription(fontDescription);
687  return;
688  }
689 
690  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
691  {
692  if (!value->isValueList())
693  return;
694 
695  FontDescription fontDescription = styleResolver->style()->fontDescription();
696  FontFamily& firstFamily = fontDescription.firstFamily();
697  FontFamily* currFamily = 0;
698 
699  // Before mapping in a new font-family property, we should reset the generic family.
700  bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
701  fontDescription.setGenericFamily(FontDescription::NoFamily);
702 
703  for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
704  CSSValue* item = i.value();
705  if (!item->isPrimitiveValue())
706  continue;
707  CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(item);
708  AtomicString face;
709  Settings* settings = styleResolver->document()->settings();
710  if (contentValue->isString())
711  face = contentValue->getStringValue();
712  else if (settings) {
713  switch (contentValue->getIdent()) {
714  case CSSValueWebkitBody:
715  face = settings->standardFontFamily();
716  break;
717  case CSSValueSerif:
718  face = serifFamily;
719  fontDescription.setGenericFamily(FontDescription::SerifFamily);
720  break;
721  case CSSValueSansSerif:
722  face = sansSerifFamily;
723  fontDescription.setGenericFamily(FontDescription::SansSerifFamily);
724  break;
725  case CSSValueCursive:
726  face = cursiveFamily;
727  fontDescription.setGenericFamily(FontDescription::CursiveFamily);
728  break;
729  case CSSValueFantasy:
730  face = fantasyFamily;
731  fontDescription.setGenericFamily(FontDescription::FantasyFamily);
732  break;
733  case CSSValueMonospace:
734  face = monospaceFamily;
735  fontDescription.setGenericFamily(FontDescription::MonospaceFamily);
736  break;
737  case CSSValueWebkitPictograph:
738  face = pictographFamily;
739  fontDescription.setGenericFamily(FontDescription::PictographFamily);
740  break;
741  }
742  }
743 
744  if (!face.isEmpty()) {
745  if (!currFamily) {
746  // Filling in the first family.
747  firstFamily.setFamily(face);
748  firstFamily.appendFamily(0); // Remove any inherited family-fallback list.
749  currFamily = &firstFamily;
750  fontDescription.setIsSpecifiedFont(fontDescription.genericFamily() == FontDescription::NoFamily);
751  } else {
752  RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create();
753  newFamily->setFamily(face);
754  currFamily->appendFamily(newFamily);
755  currFamily = newFamily.get();
756  }
757  }
758  }
759 
760  // We can't call useFixedDefaultSize() until all new font families have been added
761  // If currFamily is non-zero then we set at least one family on this description.
762  if (currFamily) {
763  if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
764  styleResolver->setFontSize(fontDescription, styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize));
765 
766  styleResolver->setFontDescription(fontDescription);
767  }
768  return;
769  }
770 
771  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
772 };
773 
774 class ApplyPropertyFontSize {
775 private:
776  // When the CSS keyword "larger" is used, this function will attempt to match within the keyword
777  // table, and failing that, will simply multiply by 1.2.
778  static float largerFontSize(float size)
779  {
780  // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to
781  // the next size level.
782  return size * 1.2f;
783  }
784 
785  // Like the previous function, but for the keyword "smaller".
786  static float smallerFontSize(float size)
787  {
788  // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to
789  // the next size level.
790  return size / 1.2f;
791  }
792 public:
793  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
794  {
795  float size = styleResolver->parentStyle()->fontDescription().specifiedSize();
796 
797  if (size < 0)
798  return;
799 
800  FontDescription fontDescription = styleResolver->style()->fontDescription();
801  fontDescription.setKeywordSize(styleResolver->parentStyle()->fontDescription().keywordSize());
802  styleResolver->setFontSize(fontDescription, size);
803  styleResolver->setFontDescription(fontDescription);
804  return;
805  }
806 
807  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
808  {
809  FontDescription fontDescription = styleResolver->style()->fontDescription();
810  float size = styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueMedium, fontDescription.useFixedDefaultSize());
811 
812  if (size < 0)
813  return;
814 
815  fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
816  styleResolver->setFontSize(fontDescription, size);
817  styleResolver->setFontDescription(fontDescription);
818  return;
819  }
820 
821  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
822  {
823  if (!value->isPrimitiveValue())
824  return;
825 
826  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
827 
828  FontDescription fontDescription = styleResolver->style()->fontDescription();
829  fontDescription.setKeywordSize(0);
830  float parentSize = 0;
831  bool parentIsAbsoluteSize = false;
832  float size = 0;
833 
834  if (styleResolver->parentStyle()) {
835  parentSize = styleResolver->parentStyle()->fontDescription().specifiedSize();
836  parentIsAbsoluteSize = styleResolver->parentStyle()->fontDescription().isAbsoluteSize();
837  }
838 
839  if (int ident = primitiveValue->getIdent()) {
840  // Keywords are being used.
841  switch (ident) {
842  case CSSValueXxSmall:
843  case CSSValueXSmall:
844  case CSSValueSmall:
845  case CSSValueMedium:
846  case CSSValueLarge:
847  case CSSValueXLarge:
848  case CSSValueXxLarge:
849  case CSSValueWebkitXxxLarge:
850  size = styleResolver->fontSizeForKeyword(styleResolver->document(), ident, fontDescription.useFixedDefaultSize());
851  fontDescription.setKeywordSize(ident - CSSValueXxSmall + 1);
852  break;
853  case CSSValueLarger:
854  size = largerFontSize(parentSize);
855  break;
856  case CSSValueSmaller:
857  size = smallerFontSize(parentSize);
858  break;
859  default:
860  return;
861  }
862 
863  fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (ident == CSSValueLarger || ident == CSSValueSmaller));
864  } else {
865  fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
866  || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
867  if (primitiveValue->isLength())
868  size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0, true);
869  else if (primitiveValue->isPercentage())
870  size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
871  else if (primitiveValue->isCalculatedPercentageWithLength())
872  size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize);
873  else if (primitiveValue->isViewportPercentageLength())
874  size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document()->renderView());
875  else
876  return;
877  }
878 
879  if (size < 0)
880  return;
881 
882  // Overly large font sizes will cause crashes on some platforms (such as Windows).
883  // Cap font size here to make sure that doesn't happen.
884  size = min(maximumAllowedFontSize, size);
885 
886  styleResolver->setFontSize(fontDescription, size);
887  styleResolver->setFontDescription(fontDescription);
888  return;
889  }
890 
891  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
892 };
893 
894 class ApplyPropertyFontWeight {
895 public:
896  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
897  {
898  if (!value->isPrimitiveValue())
899  return;
900  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
901  FontDescription fontDescription = styleResolver->fontDescription();
902  switch (primitiveValue->getIdent()) {
903  case CSSValueInvalid:
904  ASSERT_NOT_REACHED();
905  break;
906  case CSSValueBolder:
907  fontDescription.setWeight(fontDescription.bolderWeight());
908  break;
909  case CSSValueLighter:
910  fontDescription.setWeight(fontDescription.lighterWeight());
911  break;
912  default:
913  fontDescription.setWeight(*primitiveValue);
914  }
915  styleResolver->setFontDescription(fontDescription);
916  }
917  static PropertyHandler createHandler()
918  {
919  PropertyHandler handler = ApplyPropertyFont<FontWeight, &FontDescription::weight, &FontDescription::setWeight, FontWeightNormal>::createHandler();
920  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
921  }
922 };
923 
924 class ApplyPropertyFontVariantLigatures {
925 public:
926  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
927  {
928  const FontDescription& parentFontDescription = styleResolver->parentFontDescription();
929  FontDescription fontDescription = styleResolver->fontDescription();
930 
931  fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState());
932  fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState());
933  fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState());
934 
935  styleResolver->setFontDescription(fontDescription);
936  }
937 
938  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
939  {
940  FontDescription fontDescription = styleResolver->fontDescription();
941 
942  fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState);
943  fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState);
944  fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState);
945 
946  styleResolver->setFontDescription(fontDescription);
947  }
948 
949  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
950  {
951  FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState;
952  FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState;
953  FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
954 
955  if (value->isValueList()) {
956  CSSValueList* valueList = static_cast<CSSValueList*>(value);
957  for (size_t i = 0; i < valueList->length(); ++i) {
958  CSSValue* item = valueList->itemWithoutBoundsCheck(i);
959  ASSERT(item->isPrimitiveValue());
960  if (item->isPrimitiveValue()) {
961  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
962  switch (primitiveValue->getIdent()) {
963  case CSSValueNoCommonLigatures:
964  commonLigaturesState = FontDescription::DisabledLigaturesState;
965  break;
966  case CSSValueCommonLigatures:
967  commonLigaturesState = FontDescription::EnabledLigaturesState;
968  break;
969  case CSSValueNoDiscretionaryLigatures:
970  discretionaryLigaturesState = FontDescription::DisabledLigaturesState;
971  break;
972  case CSSValueDiscretionaryLigatures:
973  discretionaryLigaturesState = FontDescription::EnabledLigaturesState;
974  break;
975  case CSSValueNoHistoricalLigatures:
976  historicalLigaturesState = FontDescription::DisabledLigaturesState;
977  break;
978  case CSSValueHistoricalLigatures:
979  historicalLigaturesState = FontDescription::EnabledLigaturesState;
980  break;
981  default:
982  ASSERT_NOT_REACHED();
983  break;
984  }
985  }
986  }
987  }
988 #if !ASSERT_DISABLED
989  else {
990  ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
991  ASSERT(static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueNormal);
992  }
993 #endif
994 
995  FontDescription fontDescription = styleResolver->fontDescription();
996  fontDescription.setCommonLigaturesState(commonLigaturesState);
997  fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState);
998  fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
999  styleResolver->setFontDescription(fontDescription);
1000  }
1001 
1002  static PropertyHandler createHandler()
1003  {
1004  return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1005  }
1006 };
1007 
1008 enum BorderImageType { BorderImage = 0, BorderMask };
1009 template <BorderImageType borderImageType,
1010  CSSPropertyID property,
1011  const NinePieceImage& (RenderStyle::*getterFunction)() const,
1012  void (RenderStyle::*setterFunction)(const NinePieceImage&)>
1013 class ApplyPropertyBorderImage {
1014 public:
1015  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1016  {
1017  NinePieceImage image;
1018  if (borderImageType == BorderMask)
1019  image.setMaskDefaults();
1020  styleResolver->styleMap()->mapNinePieceImage(property, value, image);
1021  (styleResolver->style()->*setterFunction)(image);
1022  }
1023 
1024  static PropertyHandler createHandler()
1025  {
1026  PropertyHandler handler = ApplyPropertyDefaultBase<const NinePieceImage&, getterFunction, const NinePieceImage&, setterFunction, NinePieceImage, &RenderStyle::initialNinePieceImage>::createHandler();
1027  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1028  }
1029 };
1030 
1031 enum BorderImageModifierType { Outset, Repeat, Slice, Width };
1032 template <BorderImageType type, BorderImageModifierType modifier>
1033 class ApplyPropertyBorderImageModifier {
1034 private:
1035  static inline const NinePieceImage& getValue(RenderStyle* style) { return type == BorderImage ? style->borderImage() : style->maskBoxImage(); }
1036  static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == BorderImage ? style->setBorderImage(value) : style->setMaskBoxImage(value); }
1037 public:
1038  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1039  {
1040  NinePieceImage image(getValue(styleResolver->style()));
1041  switch (modifier) {
1042  case Outset:
1043  image.copyOutsetFrom(getValue(styleResolver->parentStyle()));
1044  break;
1045  case Repeat:
1046  image.copyRepeatFrom(getValue(styleResolver->parentStyle()));
1047  break;
1048  case Slice:
1049  image.copyImageSlicesFrom(getValue(styleResolver->parentStyle()));
1050  break;
1051  case Width:
1052  image.copyBorderSlicesFrom(getValue(styleResolver->parentStyle()));
1053  break;
1054  }
1055  setValue(styleResolver->style(), image);
1056  }
1057 
1058  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1059  {
1060  NinePieceImage image(getValue(styleResolver->style()));
1061  switch (modifier) {
1062  case Outset:
1063  image.setOutset(LengthBox(0));
1064  break;
1065  case Repeat:
1066  image.setHorizontalRule(StretchImageRule);
1067  image.setVerticalRule(StretchImageRule);
1068  break;
1069  case Slice:
1070  // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility.
1071  image.setImageSlices(type == BorderImage ? LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)) : LengthBox());
1072  image.setFill(false);
1073  break;
1074  case Width:
1075  // Masks have a different initial value for widths. They use an 'auto' value rather than trying to fit to the border.
1076  image.setBorderSlices(type == BorderImage ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox());
1077  break;
1078  }
1079  setValue(styleResolver->style(), image);
1080  }
1081 
1082  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1083  {
1084  NinePieceImage image(getValue(styleResolver->style()));
1085  switch (modifier) {
1086  case Outset:
1087  image.setOutset(styleResolver->styleMap()->mapNinePieceImageQuad(value));
1088  break;
1089  case Repeat:
1090  styleResolver->styleMap()->mapNinePieceImageRepeat(value, image);
1091  break;
1092  case Slice:
1093  styleResolver->styleMap()->mapNinePieceImageSlice(value, image);
1094  break;
1095  case Width:
1096  image.setBorderSlices(styleResolver->styleMap()->mapNinePieceImageQuad(value));
1097  break;
1098  }
1099  setValue(styleResolver->style(), image);
1100  }
1101 
1102  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1103 };
1104 
1105 template <CSSPropertyID id, StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)()>
1106 class ApplyPropertyBorderImageSource {
1107 public:
1108  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(id, value)); }
1109  static PropertyHandler createHandler()
1110  {
1111  PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
1112  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1113  }
1114 };
1115 
1116 enum CounterBehavior {Increment = 0, Reset};
1117 template <CounterBehavior counterBehavior>
1118 class ApplyPropertyCounter {
1119 public:
1120  static void emptyFunction(CSSPropertyID, StyleResolver*) { }
1121  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1122  {
1123  CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
1124  CounterDirectiveMap& parentMap = styleResolver->parentStyle()->accessCounterDirectives();
1125 
1126  typedef CounterDirectiveMap::iterator Iterator;
1127  Iterator end = parentMap.end();
1128  for (Iterator it = parentMap.begin(); it != end; ++it) {
1129  CounterDirectives& directives = map.add(it->key, CounterDirectives()).iterator->value;
1130  if (counterBehavior == Reset) {
1131  directives.inheritReset(it->value);
1132  } else {
1133  directives.inheritIncrement(it->value);
1134  }
1135  }
1136  }
1137  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1138  {
1139  bool setCounterIncrementToNone = counterBehavior == Increment && value->isPrimitiveValue() && static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueNone;
1140 
1141  if (!value->isValueList() && !setCounterIncrementToNone)
1142  return;
1143 
1144  CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
1145  typedef CounterDirectiveMap::iterator Iterator;
1146 
1147  Iterator end = map.end();
1148  for (Iterator it = map.begin(); it != end; ++it)
1149  if (counterBehavior == Reset)
1150  it->value.clearReset();
1151  else
1152  it->value.clearIncrement();
1153 
1154  if (setCounterIncrementToNone)
1155  return;
1156 
1157  CSSValueList* list = static_cast<CSSValueList*>(value);
1158  int length = list ? list->length() : 0;
1159  for (int i = 0; i < length; ++i) {
1160  CSSValue* currValue = list->itemWithoutBoundsCheck(i);
1161  if (!currValue->isPrimitiveValue())
1162  continue;
1163 
1164  Pair* pair = static_cast<CSSPrimitiveValue*>(currValue)->getPairValue();
1165  if (!pair || !pair->first() || !pair->second())
1166  continue;
1167 
1168  AtomicString identifier = static_cast<CSSPrimitiveValue*>(pair->first())->getStringValue();
1169  int value = static_cast<CSSPrimitiveValue*>(pair->second())->getIntValue();
1170  CounterDirectives& directives = map.add(identifier, CounterDirectives()).iterator->value;
1171  if (counterBehavior == Reset) {
1172  directives.setResetValue(value);
1173  } else {
1174  directives.addIncrementValue(value);
1175  }
1176  }
1177  }
1178  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &emptyFunction, &applyValue); }
1179 };
1180 
1181 
1182 class ApplyPropertyCursor {
1183 public:
1184  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1185  {
1186  styleResolver->style()->setCursor(styleResolver->parentStyle()->cursor());
1187  styleResolver->style()->setCursorList(styleResolver->parentStyle()->cursors());
1188  }
1189 
1190  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1191  {
1192  styleResolver->style()->clearCursorList();
1193  styleResolver->style()->setCursor(RenderStyle::initialCursor());
1194  }
1195 
1196  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1197  {
1198  styleResolver->style()->clearCursorList();
1199  if (value->isValueList()) {
1200  CSSValueList* list = static_cast<CSSValueList*>(value);
1201  int len = list->length();
1202  styleResolver->style()->setCursor(CURSOR_AUTO);
1203  for (int i = 0; i < len; i++) {
1204  CSSValue* item = list->itemWithoutBoundsCheck(i);
1205  if (item->isCursorImageValue()) {
1206  CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(item);
1207  if (image->updateIfSVGCursorIsUsed(styleResolver->element())) // Elements with SVG cursors are not allowed to share style.
1208  styleResolver->style()->setUnique();
1209  styleResolver->style()->addCursor(styleResolver->styleImage(CSSPropertyCursor, image), image->hotSpot());
1210  } else if (item->isPrimitiveValue()) {
1211  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
1212  if (primitiveValue->isIdent())
1213  styleResolver->style()->setCursor(*primitiveValue);
1214  }
1215  }
1216  } else if (value->isPrimitiveValue()) {
1217  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1218  if (primitiveValue->isIdent() && styleResolver->style()->cursor() != ECursor(*primitiveValue))
1219  styleResolver->style()->setCursor(*primitiveValue);
1220  }
1221  }
1222 
1223  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1224 };
1225 
1226 class ApplyPropertyTextAlign {
1227 public:
1228  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1229  {
1230  if (!value->isPrimitiveValue())
1231  return;
1232 
1233  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1234 
1235  if (primitiveValue->getIdent() != CSSValueWebkitMatchParent)
1236  styleResolver->style()->setTextAlign(*primitiveValue);
1237  else if (styleResolver->parentStyle()->textAlign() == TASTART)
1238  styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
1239  else if (styleResolver->parentStyle()->textAlign() == TAEND)
1240  styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);
1241  else
1242  styleResolver->style()->setTextAlign(styleResolver->parentStyle()->textAlign());
1243  }
1244  static PropertyHandler createHandler()
1245  {
1246  PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlign, ETextAlign, &RenderStyle::setTextAlign, ETextAlign, &RenderStyle::initialTextAlign>::createHandler();
1247  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1248  }
1249 };
1250 
1251 class ApplyPropertyTextDecoration {
1252 public:
1253  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1254  {
1255  ETextDecoration t = RenderStyle::initialTextDecoration();
1256  for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
1257  CSSValue* item = i.value();
1258  ASSERT_WITH_SECURITY_IMPLICATION(item->isPrimitiveValue());
1259  t |= *static_cast<CSSPrimitiveValue*>(item);
1260  }
1261  styleResolver->style()->setTextDecoration(t);
1262  }
1263  static PropertyHandler createHandler()
1264  {
1265  PropertyHandler handler = ApplyPropertyDefaultBase<ETextDecoration, &RenderStyle::textDecoration, ETextDecoration, &RenderStyle::setTextDecoration, ETextDecoration, &RenderStyle::initialTextDecoration>::createHandler();
1266  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1267  }
1268 };
1269 
1270 class ApplyPropertyMarqueeIncrement {
1271 public:
1272  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1273  {
1274  if (!value->isPrimitiveValue())
1275  return;
1276 
1277  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1278  if (primitiveValue->getIdent()) {
1279  switch (primitiveValue->getIdent()) {
1280  case CSSValueSmall:
1281  styleResolver->style()->setMarqueeIncrement(Length(1, Fixed)); // 1px.
1282  break;
1283  case CSSValueNormal:
1284  styleResolver->style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default.
1285  break;
1286  case CSSValueLarge:
1287  styleResolver->style()->setMarqueeIncrement(Length(36, Fixed)); // 36px.
1288  break;
1289  }
1290  } else {
1291  Length marqueeLength = styleResolver->convertToIntLength(primitiveValue, styleResolver->style(), styleResolver->rootElementStyle());
1292  if (!marqueeLength.isUndefined())
1293  styleResolver->style()->setMarqueeIncrement(marqueeLength);
1294  }
1295  }
1296  static PropertyHandler createHandler()
1297  {
1298  PropertyHandler handler = ApplyPropertyLength<&RenderStyle::marqueeIncrement, &RenderStyle::setMarqueeIncrement, &RenderStyle::initialMarqueeIncrement>::createHandler();
1299  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1300  }
1301 };
1302 
1303 class ApplyPropertyMarqueeRepetition {
1304 public:
1305  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1306  {
1307  if (!value->isPrimitiveValue())
1308  return;
1309 
1310  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1311  if (primitiveValue->getIdent() == CSSValueInfinite)
1312  styleResolver->style()->setMarqueeLoopCount(-1); // -1 means repeat forever.
1313  else if (primitiveValue->isNumber())
1314  styleResolver->style()->setMarqueeLoopCount(primitiveValue->getIntValue());
1315  }
1316  static PropertyHandler createHandler()
1317  {
1318  PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeLoopCount, int, &RenderStyle::setMarqueeLoopCount, int, &RenderStyle::initialMarqueeLoopCount>::createHandler();
1319  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1320  }
1321 };
1322 
1323 class ApplyPropertyMarqueeSpeed {
1324 public:
1325  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1326  {
1327  if (!value->isPrimitiveValue())
1328  return;
1329 
1330  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1331  if (int ident = primitiveValue->getIdent()) {
1332  switch (ident) {
1333  case CSSValueSlow:
1334  styleResolver->style()->setMarqueeSpeed(500); // 500 msec.
1335  break;
1336  case CSSValueNormal:
1337  styleResolver->style()->setMarqueeSpeed(85); // 85msec. The WinIE default.
1338  break;
1339  case CSSValueFast:
1340  styleResolver->style()->setMarqueeSpeed(10); // 10msec. Super fast.
1341  break;
1342  }
1343  } else if (primitiveValue->isTime())
1344  styleResolver->style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>());
1345  else if (primitiveValue->isNumber()) // For scrollamount support.
1346  styleResolver->style()->setMarqueeSpeed(primitiveValue->getIntValue());
1347  }
1348  static PropertyHandler createHandler()
1349  {
1350  PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeSpeed, int, &RenderStyle::setMarqueeSpeed, int, &RenderStyle::initialMarqueeSpeed>::createHandler();
1351  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1352  }
1353 };
1354 
1355 #if ENABLE(CSS3_TEXT)
1356 class ApplyPropertyTextUnderlinePosition {
1357 public:
1358  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1359  {
1360  // This is true if value is 'auto' or 'alphabetic'.
1361  if (value->isPrimitiveValue()) {
1362  TextUnderlinePosition t = *static_cast<CSSPrimitiveValue*>(value);
1363  styleResolver->style()->setTextUnderlinePosition(t);
1364  return;
1365  }
1366 
1367  unsigned t = 0;
1368  for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
1369  CSSValue* item = i.value();
1370  ASSERT(item->isPrimitiveValue());
1371  TextUnderlinePosition t2 = *static_cast<CSSPrimitiveValue*>(item);
1372  t |= t2;
1373  }
1374  styleResolver->style()->setTextUnderlinePosition(static_cast<TextUnderlinePosition>(t));
1375  }
1376  static PropertyHandler createHandler()
1377  {
1378  PropertyHandler handler = ApplyPropertyDefaultBase<TextUnderlinePosition, &RenderStyle::textUnderlinePosition, TextUnderlinePosition, &RenderStyle::setTextUnderlinePosition, TextUnderlinePosition, &RenderStyle::initialTextUnderlinePosition>::createHandler();
1379  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1380  }
1381 };
1382 #endif // CSS3_TEXT
1383 
1384 class ApplyPropertyLineHeight {
1385 public:
1386  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1387  {
1388  if (!value->isPrimitiveValue())
1389  return;
1390 
1391  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1392  Length lineHeight;
1393 
1394  if (primitiveValue->getIdent() == CSSValueNormal)
1395  lineHeight = RenderStyle::initialLineHeight();
1396  else if (primitiveValue->isLength()) {
1397  double multiplier = styleResolver->style()->effectiveZoom();
1398  if (Frame* frame = styleResolver->document()->frame())
1399  multiplier *= frame->textZoomFactor();
1400  lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
1401  } else if (primitiveValue->isPercentage()) {
1402  // FIXME: percentage should not be restricted to an integer here.
1403  lineHeight = Length((styleResolver->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
1404  } else if (primitiveValue->isNumber()) {
1405  // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
1406  lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
1407  } else if (primitiveValue->isViewportPercentageLength())
1408  lineHeight = primitiveValue->viewportPercentageLength();
1409  else
1410  return;
1411  styleResolver->style()->setLineHeight(lineHeight);
1412  }
1413  static PropertyHandler createHandler()
1414  {
1415  PropertyHandler handler = ApplyPropertyDefaultBase<Length, &RenderStyle::specifiedLineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
1416  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1417  }
1418 };
1419 
1420 class ApplyPropertyPageSize {
1421 private:
1422  static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0); }
1423  static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
1424  static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
1425  {
1426  DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
1427  DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210)));
1428  DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210)));
1429  DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297)));
1430  DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297)));
1431  DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420)));
1432  DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176)));
1433  DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250)));
1434  DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250)));
1435  DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353)));
1436  DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
1437  DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
1438  DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
1439  DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
1440  DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
1441  DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));
1442 
1443  if (!pageSizeName)
1444  return false;
1445 
1446  switch (pageSizeName->getIdent()) {
1447  case CSSValueA5:
1448  width = a5Width;
1449  height = a5Height;
1450  break;
1451  case CSSValueA4:
1452  width = a4Width;
1453  height = a4Height;
1454  break;
1455  case CSSValueA3:
1456  width = a3Width;
1457  height = a3Height;
1458  break;
1459  case CSSValueB5:
1460  width = b5Width;
1461  height = b5Height;
1462  break;
1463  case CSSValueB4:
1464  width = b4Width;
1465  height = b4Height;
1466  break;
1467  case CSSValueLetter:
1468  width = letterWidth;
1469  height = letterHeight;
1470  break;
1471  case CSSValueLegal:
1472  width = legalWidth;
1473  height = legalHeight;
1474  break;
1475  case CSSValueLedger:
1476  width = ledgerWidth;
1477  height = ledgerHeight;
1478  break;
1479  default:
1480  return false;
1481  }
1482 
1483  if (pageOrientation) {
1484  switch (pageOrientation->getIdent()) {
1485  case CSSValueLandscape:
1486  std::swap(width, height);
1487  break;
1488  case CSSValuePortrait:
1489  // Nothing to do.
1490  break;
1491  default:
1492  return false;
1493  }
1494  }
1495  return true;
1496  }
1497 public:
1498  static void applyInheritValue(CSSPropertyID, StyleResolver*) { }
1499  static void applyInitialValue(CSSPropertyID, StyleResolver*) { }
1500  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1501  {
1502  styleResolver->style()->resetPageSizeType();
1503  Length width;
1504  Length height;
1505  PageSizeType pageSizeType = PAGE_SIZE_AUTO;
1506  CSSValueListInspector inspector(value);
1507  switch (inspector.length()) {
1508  case 2: {
1509  // <length>{2} | <page-size> <orientation>
1510  if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue())
1511  return;
1512  CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(inspector.first());
1513  CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(inspector.second());
1514  if (first->isLength()) {
1515  // <length>{2}
1516  if (!second->isLength())
1517  return;
1518  width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1519  height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1520  } else {
1521  // <page-size> <orientation>
1522  // The value order is guaranteed. See CSSParser::parseSizeParameter.
1523  if (!getPageSizeFromName(first, second, width, height))
1524  return;
1525  }
1526  pageSizeType = PAGE_SIZE_RESOLVED;
1527  break;
1528  }
1529  case 1: {
1530  // <length> | auto | <page-size> | [ portrait | landscape]
1531  if (!inspector.first()->isPrimitiveValue())
1532  return;
1533  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(inspector.first());
1534  if (primitiveValue->isLength()) {
1535  // <length>
1536  pageSizeType = PAGE_SIZE_RESOLVED;
1537  width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1538  } else {
1539  switch (primitiveValue->getIdent()) {
1540  case 0:
1541  return;
1542  case CSSValueAuto:
1543  pageSizeType = PAGE_SIZE_AUTO;
1544  break;
1545  case CSSValuePortrait:
1546  pageSizeType = PAGE_SIZE_AUTO_PORTRAIT;
1547  break;
1548  case CSSValueLandscape:
1549  pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE;
1550  break;
1551  default:
1552  // <page-size>
1553  pageSizeType = PAGE_SIZE_RESOLVED;
1554  if (!getPageSizeFromName(primitiveValue, 0, width, height))
1555  return;
1556  }
1557  }
1558  break;
1559  }
1560  default:
1561  return;
1562  }
1563  styleResolver->style()->setPageSizeType(pageSizeType);
1564  styleResolver->style()->setPageSize(LengthSize(width, height));
1565  }
1566  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1567 };
1568 
1569 class ApplyPropertyTextEmphasisStyle {
1570 public:
1571  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1572  {
1573  styleResolver->style()->setTextEmphasisFill(styleResolver->parentStyle()->textEmphasisFill());
1574  styleResolver->style()->setTextEmphasisMark(styleResolver->parentStyle()->textEmphasisMark());
1575  styleResolver->style()->setTextEmphasisCustomMark(styleResolver->parentStyle()->textEmphasisCustomMark());
1576  }
1577 
1578  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1579  {
1580  styleResolver->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
1581  styleResolver->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
1582  styleResolver->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
1583  }
1584 
1585  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1586  {
1587  if (value->isValueList()) {
1588  CSSValueList* list = static_cast<CSSValueList*>(value);
1589  ASSERT(list->length() == 2);
1590  if (list->length() != 2)
1591  return;
1592  for (unsigned i = 0; i < 2; ++i) {
1593  CSSValue* item = list->itemWithoutBoundsCheck(i);
1594  if (!item->isPrimitiveValue())
1595  continue;
1596 
1597  CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(item);
1598  if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen)
1599  styleResolver->style()->setTextEmphasisFill(*value);
1600  else
1601  styleResolver->style()->setTextEmphasisMark(*value);
1602  }
1603  styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
1604  return;
1605  }
1606 
1607  if (!value->isPrimitiveValue())
1608  return;
1609  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1610 
1611  if (primitiveValue->isString()) {
1612  styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
1613  styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
1614  styleResolver->style()->setTextEmphasisCustomMark(primitiveValue->getStringValue());
1615  return;
1616  }
1617 
1618  styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
1619 
1620  if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getIdent() == CSSValueOpen) {
1621  styleResolver->style()->setTextEmphasisFill(*primitiveValue);
1622  styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
1623  } else {
1624  styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
1625  styleResolver->style()->setTextEmphasisMark(*primitiveValue);
1626  }
1627  }
1628 
1629  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1630 };
1631 
1632 template <typename T,
1633  T (Animation::*getterFunction)() const,
1634  void (Animation::*setterFunction)(T),
1635  bool (Animation::*testFunction)() const,
1636  void (Animation::*clearFunction)(),
1637  T (*initialFunction)(),
1638  void (CSSToStyleMap::*mapFunction)(Animation*, CSSValue*),
1639  AnimationList* (RenderStyle::*animationGetterFunction)(),
1640  const AnimationList* (RenderStyle::*immutableAnimationGetterFunction)() const>
1641 class ApplyPropertyAnimation {
1642 public:
1643  static void setValue(Animation* animation, T value) { (animation->*setterFunction)(value); }
1644  static T value(const Animation* animation) { return (animation->*getterFunction)(); }
1645  static bool test(const Animation* animation) { return (animation->*testFunction)(); }
1646  static void clear(Animation* animation) { (animation->*clearFunction)(); }
1647  static T initial() { return (*initialFunction)(); }
1648  static void map(StyleResolver* styleResolver, Animation* animation, CSSValue* value) { (styleResolver->styleMap()->*mapFunction)(animation, value); }
1649  static AnimationList* accessAnimations(RenderStyle* style) { return (style->*animationGetterFunction)(); }
1650  static const AnimationList* animations(RenderStyle* style) { return (style->*immutableAnimationGetterFunction)(); }
1651 
1652  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1653  {
1654  AnimationList* list = accessAnimations(styleResolver->style());
1655  const AnimationList* parentList = animations(styleResolver->parentStyle());
1656  size_t i = 0, parentSize = parentList ? parentList->size() : 0;
1657  for ( ; i < parentSize && test(parentList->animation(i)); ++i) {
1658  if (list->size() <= i)
1659  list->append(Animation::create());
1660  setValue(list->animation(i), value(parentList->animation(i)));
1661  list->animation(i)->setAnimationMode(parentList->animation(i)->animationMode());
1662  }
1663 
1664  /* Reset any remaining animations to not have the property set. */
1665  for ( ; i < list->size(); ++i)
1666  clear(list->animation(i));
1667  }
1668 
1669  static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
1670  {
1671  AnimationList* list = accessAnimations(styleResolver->style());
1672  if (list->isEmpty())
1673  list->append(Animation::create());
1674  setValue(list->animation(0), initial());
1675  if (propertyID == CSSPropertyWebkitTransitionProperty)
1676  list->animation(0)->setAnimationMode(Animation::AnimateAll);
1677  for (size_t i = 1; i < list->size(); ++i)
1678  clear(list->animation(i));
1679  }
1680 
1681  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1682  {
1683  AnimationList* list = accessAnimations(styleResolver->style());
1684  size_t childIndex = 0;
1685  if (value->isValueList()) {
1686  /* Walk each value and put it into an animation, creating new animations as needed. */
1687  for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
1688  if (childIndex <= list->size())
1689  list->append(Animation::create());
1690  map(styleResolver, list->animation(childIndex), i.value());
1691  ++childIndex;
1692  }
1693  } else {
1694  if (list->isEmpty())
1695  list->append(Animation::create());
1696  map(styleResolver, list->animation(childIndex), value);
1697  childIndex = 1;
1698  }
1699  for ( ; childIndex < list->size(); ++childIndex) {
1700  /* Reset all remaining animations to not have the property set. */
1701  clear(list->animation(childIndex));
1702  }
1703  }
1704 
1705  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1706 };
1707 
1708 class ApplyPropertyOutlineStyle {
1709 public:
1710  static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
1711  {
1712  ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInheritValue(propertyID, styleResolver);
1713  ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInheritValue(propertyID, styleResolver);
1714  }
1715 
1716  static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
1717  {
1718  ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInitialValue(propertyID, styleResolver);
1719  ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInitialValue(propertyID, styleResolver);
1720  }
1721 
1722  static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
1723  {
1724  ApplyPropertyDefault<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyValue(propertyID, styleResolver, value);
1725  ApplyPropertyDefault<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyValue(propertyID, styleResolver, value);
1726  }
1727 
1728  static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1729 };
1730 
1731 class ApplyPropertyResize {
1732 public:
1733  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1734  {
1735  if (!value->isPrimitiveValue())
1736  return;
1737 
1738  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1739 
1740  EResize r = RESIZE_NONE;
1741  switch (primitiveValue->getIdent()) {
1742  case 0:
1743  return;
1744  case CSSValueAuto:
1745  if (Settings* settings = styleResolver->document()->settings())
1746  r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
1747  break;
1748  default:
1749  r = *primitiveValue;
1750  }
1751  styleResolver->style()->setResize(r);
1752  }
1753 
1754  static PropertyHandler createHandler()
1755  {
1756  PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize>::createHandler();
1757  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1758  }
1759 };
1760 
1761 class ApplyPropertyVerticalAlign {
1762 public:
1763  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1764  {
1765  if (!value->isPrimitiveValue())
1766  return;
1767 
1768  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1769 
1770  if (primitiveValue->getIdent())
1771  return styleResolver->style()->setVerticalAlign(*primitiveValue);
1772 
1773  styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
1774  }
1775 
1776  static PropertyHandler createHandler()
1777  {
1778  PropertyHandler handler = ApplyPropertyDefaultBase<EVerticalAlign, &RenderStyle::verticalAlign, EVerticalAlign, &RenderStyle::setVerticalAlign, EVerticalAlign, &RenderStyle::initialVerticalAlign>::createHandler();
1779  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1780  }
1781 };
1782 
1783 class ApplyPropertyAspectRatio {
1784 public:
1785  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1786  {
1787  if (!styleResolver->parentStyle()->hasAspectRatio())
1788  return;
1789  styleResolver->style()->setHasAspectRatio(true);
1790  styleResolver->style()->setAspectRatioDenominator(styleResolver->parentStyle()->aspectRatioDenominator());
1791  styleResolver->style()->setAspectRatioNumerator(styleResolver->parentStyle()->aspectRatioNumerator());
1792  }
1793 
1794  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1795  {
1796  styleResolver->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio());
1797  styleResolver->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
1798  styleResolver->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
1799  }
1800 
1801  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1802  {
1803  if (!value->isAspectRatioValue()) {
1804  styleResolver->style()->setHasAspectRatio(false);
1805  return;
1806  }
1807  CSSAspectRatioValue* aspectRatioValue = static_cast<CSSAspectRatioValue*>(value);
1808  styleResolver->style()->setHasAspectRatio(true);
1809  styleResolver->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
1810  styleResolver->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
1811  }
1812 
1813  static PropertyHandler createHandler()
1814  {
1815  return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1816  }
1817 };
1818 
1819 class ApplyPropertyZoom {
1820 private:
1821  static void resetEffectiveZoom(StyleResolver* styleResolver)
1822  {
1823  // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.
1824  styleResolver->setEffectiveZoom(styleResolver->parentStyle() ? styleResolver->parentStyle()->effectiveZoom() : RenderStyle::initialZoom());
1825  }
1826 
1827 public:
1828  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1829  {
1830  resetEffectiveZoom(styleResolver);
1831  styleResolver->setZoom(styleResolver->parentStyle()->zoom());
1832  }
1833 
1834  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1835  {
1836  resetEffectiveZoom(styleResolver);
1837  styleResolver->setZoom(RenderStyle::initialZoom());
1838  }
1839 
1840  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1841  {
1842  ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
1843  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1844 
1845  if (primitiveValue->getIdent() == CSSValueNormal) {
1846  resetEffectiveZoom(styleResolver);
1847  styleResolver->setZoom(RenderStyle::initialZoom());
1848  } else if (primitiveValue->getIdent() == CSSValueReset) {
1849  styleResolver->setEffectiveZoom(RenderStyle::initialZoom());
1850  styleResolver->setZoom(RenderStyle::initialZoom());
1851  } else if (primitiveValue->getIdent() == CSSValueDocument) {
1852  float docZoom = styleResolver->rootElementStyle() ? styleResolver->rootElementStyle()->zoom() : RenderStyle::initialZoom();
1853  styleResolver->setEffectiveZoom(docZoom);
1854  styleResolver->setZoom(docZoom);
1855  } else if (primitiveValue->isPercentage()) {
1856  resetEffectiveZoom(styleResolver);
1857  if (float percent = primitiveValue->getFloatValue())
1858  styleResolver->setZoom(percent / 100.0f);
1859  } else if (primitiveValue->isNumber()) {
1860  resetEffectiveZoom(styleResolver);
1861  if (float number = primitiveValue->getFloatValue())
1862  styleResolver->setZoom(number);
1863  }
1864  }
1865 
1866  static PropertyHandler createHandler()
1867  {
1868  return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1869  }
1870 };
1871 
1872 class ApplyPropertyDisplay {
1873 private:
1874  static inline bool isValidDisplayValue(StyleResolver* styleResolver, EDisplay displayPropertyValue)
1875  {
1876 #if ENABLE(SVG)
1877  if (styleResolver->element() && styleResolver->element()->isSVGElement() && styleResolver->style()->styleType() == NOPSEUDO)
1878  return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE);
1879 #else
1880  UNUSED_PARAM(styleResolver);
1881  UNUSED_PARAM(displayPropertyValue);
1882 #endif
1883  return true;
1884  }
1885 public:
1886  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1887  {
1888  EDisplay display = styleResolver->parentStyle()->display();
1889  if (!isValidDisplayValue(styleResolver, display))
1890  return;
1891  styleResolver->style()->setDisplay(display);
1892  }
1893 
1894  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1895  {
1896  styleResolver->style()->setDisplay(RenderStyle::initialDisplay());
1897  }
1898 
1899  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1900  {
1901  if (!value->isPrimitiveValue())
1902  return;
1903 
1904  EDisplay display = *static_cast<CSSPrimitiveValue*>(value);
1905 
1906  if (!isValidDisplayValue(styleResolver, display))
1907  return;
1908 
1909  styleResolver->style()->setDisplay(display);
1910  }
1911 
1912  static PropertyHandler createHandler()
1913  {
1914  return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1915  }
1916 };
1917 
1918 template <ClipPathOperation* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ClipPathOperation>), ClipPathOperation* (*initialFunction)()>
1919 class ApplyPropertyClipPath {
1920 public:
1921  static void setValue(RenderStyle* style, PassRefPtr<ClipPathOperation> value) { (style->*setterFunction)(value); }
1922  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1923  {
1924  if (value->isPrimitiveValue()) {
1925  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1926  if (primitiveValue->getIdent() == CSSValueNone)
1927  setValue(styleResolver->style(), 0);
1928  else if (primitiveValue->isShape()) {
1929  setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver, primitiveValue->getShapeValue())));
1930  }
1931 #if ENABLE(SVG)
1932  else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) {
1933  String cssURLValue = primitiveValue->getStringValue();
1934  KURL url = styleResolver->document()->completeURL(cssURLValue);
1935  // FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405)
1936  setValue(styleResolver->style(), ReferenceClipPathOperation::create(cssURLValue, url.fragmentIdentifier()));
1937  }
1938 #endif
1939  }
1940  }
1941  static PropertyHandler createHandler()
1942  {
1943  PropertyHandler handler = ApplyPropertyDefaultBase<ClipPathOperation*, getterFunction, PassRefPtr<ClipPathOperation>, setterFunction, ClipPathOperation*, initialFunction>::createHandler();
1944  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1945  }
1946 };
1947 
1948 #if ENABLE(CSS_EXCLUSIONS)
1949 template <ExclusionShapeValue* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ExclusionShapeValue>), ExclusionShapeValue* (*initialFunction)()>
1950 class ApplyPropertyExclusionShape {
1951 public:
1952  static void setValue(RenderStyle* style, PassRefPtr<ExclusionShapeValue> value) { (style->*setterFunction)(value); }
1953  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1954  {
1955  if (value->isPrimitiveValue()) {
1956  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1957  if (primitiveValue->getIdent() == CSSValueAuto)
1958  setValue(styleResolver->style(), 0);
1959  // FIXME Bug 102571: Layout for the value 'outside-shape' is not yet implemented
1960  else if (primitiveValue->getIdent() == CSSValueOutsideShape)
1961  setValue(styleResolver->style(), ExclusionShapeValue::createOutsideValue());
1962  else if (primitiveValue->isShape()) {
1963  RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createShapeValue(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()));
1964  setValue(styleResolver->style(), shape.release());
1965  }
1966  }
1967  }
1968  static PropertyHandler createHandler()
1969  {
1970  PropertyHandler handler = ApplyPropertyDefaultBase<ExclusionShapeValue*, getterFunction, PassRefPtr<ExclusionShapeValue>, setterFunction, ExclusionShapeValue*, initialFunction>::createHandler();
1971  return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1972  }
1973 };
1974 #endif
1975 
1976 #if ENABLE(CSS_IMAGE_RESOLUTION)
1977 class ApplyPropertyImageResolution {
1978 public:
1979  static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
1980  {
1981  ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInheritValue(propertyID, styleResolver);
1982  ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInheritValue(propertyID, styleResolver);
1983  ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInheritValue(propertyID, styleResolver);
1984  }
1985 
1986  static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
1987  {
1988  ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInitialValue(propertyID, styleResolver);
1989  ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInitialValue(propertyID, styleResolver);
1990  ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInitialValue(propertyID, styleResolver);
1991  }
1992 
1993  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1994  {
1995  if (!value->isValueList())
1996  return;
1997  CSSValueList* valueList = static_cast<CSSValueList*>(value);
1998  ImageResolutionSource source = RenderStyle::initialImageResolutionSource();
1999  ImageResolutionSnap snap = RenderStyle::initialImageResolutionSnap();
2000  double resolution = RenderStyle::initialImageResolution();
2001  for (size_t i = 0; i < valueList->length(); i++) {
2002  CSSValue* item = valueList->itemWithoutBoundsCheck(i);
2003  if (!item->isPrimitiveValue())
2004  continue;
2005  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
2006  if (primitiveValue->getIdent() == CSSValueFromImage)
2007  source = ImageResolutionFromImage;
2008  else if (primitiveValue->getIdent() == CSSValueSnap)
2009  snap = ImageResolutionSnapPixels;
2010  else
2011  resolution = primitiveValue->getDoubleValue(CSSPrimitiveValue::CSS_DPPX);
2012  }
2013  styleResolver->style()->setImageResolutionSource(source);
2014  styleResolver->style()->setImageResolutionSnap(snap);
2015  styleResolver->style()->setImageResolution(resolution);
2016  }
2017 
2018  static PropertyHandler createHandler()
2019  {
2020  return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
2021  }
2022 };
2023 #endif
2024 
2025 class ApplyPropertyTextIndent {
2026 public:
2027  static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
2028  {
2029  styleResolver->style()->setTextIndent(styleResolver->parentStyle()->textIndent());
2030 #if ENABLE(CSS3_TEXT)
2031  styleResolver->style()->setTextIndentLine(styleResolver->parentStyle()->textIndentLine());
2032 #endif
2033  }
2034 
2035  static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
2036  {
2037  styleResolver->style()->setTextIndent(RenderStyle::initialTextIndent());
2038 #if ENABLE(CSS3_TEXT)
2039  styleResolver->style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
2040 #endif
2041  }
2042 
2043  static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
2044  {
2045  if (!value->isValueList())
2046  return;
2047 
2048  // [ <length> | <percentage> ] -webkit-each-line
2049  // The order is guaranteed. See CSSParser::parseTextIndent.
2050  // The second value, -webkit-each-line is handled only when CSS3_TEXT is enabled.
2051 
2052  CSSValueList* valueList = static_cast<CSSValueList*>(value);
2053  CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valueList->itemWithoutBoundsCheck(0));
2054  Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
2055  ASSERT(!lengthOrPercentageValue.isUndefined());
2056  styleResolver->style()->setTextIndent(lengthOrPercentageValue);
2057 
2058 #if ENABLE(CSS3_TEXT)
2059  ASSERT(valueList->length() <= 2);
2060  CSSPrimitiveValue* eachLineValue = static_cast<CSSPrimitiveValue*>(valueList->item(1));
2061  if (eachLineValue) {
2062  ASSERT(eachLineValue->getIdent() == CSSValueWebkitEachLine);
2063  styleResolver->style()->setTextIndentLine(TextIndentEachLine);
2064  } else
2065  styleResolver->style()->setTextIndentLine(TextIndentFirstLine);
2066 #endif
2067  }
2068 
2069  static PropertyHandler createHandler()
2070  {
2071  return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
2072  }
2073 };
2074 
2075 const StyleBuilder& StyleBuilder::sharedStyleBuilder()
2076 {
2077  DEFINE_STATIC_LOCAL(StyleBuilder, styleBuilderInstance, ());
2078  return styleBuilderInstance;
2079 }
2080 
2081 StyleBuilder::StyleBuilder()
2082 {
2083  for (int i = 0; i < numCSSProperties; ++i)
2084  m_propertyMap[i] = PropertyHandler();
2085 
2086  // Please keep CSS property list in alphabetical order.
2087  setPropertyHandler(CSSPropertyBackgroundAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSToStyleMap::mapFillAttachment>::createHandler());
2088  setPropertyHandler(CSSPropertyBackgroundClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSToStyleMap::mapFillClip>::createHandler());
2089  setPropertyHandler(CSSPropertyBackgroundColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor, &RenderStyle::invalidColor>::createHandler());
2090  setPropertyHandler(CSSPropertyBackgroundImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSToStyleMap::mapFillImage>::createHandler());
2091  setPropertyHandler(CSSPropertyBackgroundOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSToStyleMap::mapFillOrigin>::createHandler());
2092  setPropertyHandler(CSSPropertyBackgroundPositionX, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSToStyleMap::mapFillXPosition>::createHandler());
2093  setPropertyHandler(CSSPropertyBackgroundPositionY, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSToStyleMap::mapFillYPosition>::createHandler());
2094  setPropertyHandler(CSSPropertyBackgroundRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSToStyleMap::mapFillRepeatX>::createHandler());
2095  setPropertyHandler(CSSPropertyBackgroundRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler());
2096  setPropertyHandler(CSSPropertyBackgroundSize, ApplyPropertyFillLayer<FillSize, CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
2097  setPropertyHandler(CSSPropertyBorderBottomColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor, &RenderStyle::color>::createHandler());
2098  setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
2099  setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
2100  setPropertyHandler(CSSPropertyBorderBottomStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderBottomStyle, EBorderStyle, &RenderStyle::setBorderBottomStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2101  setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2102  setPropertyHandler(CSSPropertyBorderCollapse, ApplyPropertyDefault<EBorderCollapse, &RenderStyle::borderCollapse, EBorderCollapse, &RenderStyle::setBorderCollapse, EBorderCollapse, &RenderStyle::initialBorderCollapse>::createHandler());
2103  setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier<BorderImage, Outset>::createHandler());
2104  setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier<BorderImage, Repeat>::createHandler());
2105  setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier<BorderImage, Slice>::createHandler());
2106  setPropertyHandler(CSSPropertyBorderImageSource, ApplyPropertyBorderImageSource<CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource, &RenderStyle::initialBorderImageSource>::createHandler());
2107  setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier<BorderImage, Width>::createHandler());
2108  setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color>::createHandler());
2109  setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderLeftStyle, EBorderStyle, &RenderStyle::setBorderLeftStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2110  setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2111  setPropertyHandler(CSSPropertyBorderRightColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color>::createHandler());
2112  setPropertyHandler(CSSPropertyBorderRightStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderRightStyle, EBorderStyle, &RenderStyle::setBorderRightStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2113  setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2114  setPropertyHandler(CSSPropertyBorderTopColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color>::createHandler());
2115  setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
2116  setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
2117  setPropertyHandler(CSSPropertyBorderTopStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderTopStyle, EBorderStyle, &RenderStyle::setBorderTopStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2118  setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2119  setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
2120  setPropertyHandler(CSSPropertyBoxSizing, ApplyPropertyDefault<EBoxSizing, &RenderStyle::boxSizing, EBoxSizing, &RenderStyle::setBoxSizing, EBoxSizing, &RenderStyle::initialBoxSizing>::createHandler());
2121  setPropertyHandler(CSSPropertyCaptionSide, ApplyPropertyDefault<ECaptionSide, &RenderStyle::captionSide, ECaptionSide, &RenderStyle::setCaptionSide, ECaptionSide, &RenderStyle::initialCaptionSide>::createHandler());
2122  setPropertyHandler(CSSPropertyClear, ApplyPropertyDefault<EClear, &RenderStyle::clear, EClear, &RenderStyle::setClear, EClear, &RenderStyle::initialClear>::createHandler());
2123  setPropertyHandler(CSSPropertyClip, ApplyPropertyClip::createHandler());
2124  setPropertyHandler(CSSPropertyColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::setVisitedLinkColor, &RenderStyle::invalidColor, RenderStyle::initialColor>::createHandler());
2125  setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter<Increment>::createHandler());
2126  setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter<Reset>::createHandler());
2127  setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler());
2128  setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler());
2129  setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());
2130  setPropertyHandler(CSSPropertyEmptyCells, ApplyPropertyDefault<EEmptyCell, &RenderStyle::emptyCells, EEmptyCell, &RenderStyle::setEmptyCells, EEmptyCell, &RenderStyle::initialEmptyCells>::createHandler());
2131  setPropertyHandler(CSSPropertyFloat, ApplyPropertyDefault<EFloat, &RenderStyle::floating, EFloat, &RenderStyle::setFloating, EFloat, &RenderStyle::initialFloating>::createHandler());
2132  setPropertyHandler(CSSPropertyFontFamily, ApplyPropertyFontFamily::createHandler());
2133  setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());
2134  setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler());
2135  setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler());
2136  setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
2137  setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled, NoneDisabled, UndefinedDisabled>::createHandler());
2138 #if ENABLE(CSS_IMAGE_ORIENTATION)
2139  setPropertyHandler(CSSPropertyImageOrientation, ApplyPropertyDefault<ImageOrientationEnum, &RenderStyle::imageOrientation, ImageOrientationEnum, &RenderStyle::setImageOrientation, ImageOrientationEnum, &RenderStyle::initialImageOrientation>::createHandler());
2140 #endif
2141  setPropertyHandler(CSSPropertyImageRendering, ApplyPropertyDefault<EImageRendering, &RenderStyle::imageRendering, EImageRendering, &RenderStyle::setImageRendering, EImageRendering, &RenderStyle::initialImageRendering>::createHandler());
2142 #if ENABLE(CSS_IMAGE_RESOLUTION)
2143  setPropertyHandler(CSSPropertyImageResolution, ApplyPropertyImageResolution::createHandler());
2144 #endif
2145  setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
2146  setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
2147  setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());
2148  setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler());
2149  setPropertyHandler(CSSPropertyListStylePosition, ApplyPropertyDefault<EListStylePosition, &RenderStyle::listStylePosition, EListStylePosition, &RenderStyle::setListStylePosition, EListStylePosition, &RenderStyle::initialListStylePosition>::createHandler());
2150  setPropertyHandler(CSSPropertyListStyleType, ApplyPropertyDefault<EListStyleType, &RenderStyle::listStyleType, EListStyleType, &RenderStyle::setListStyleType, EListStyleType, &RenderStyle::initialListStyleType>::createHandler());
2151  setPropertyHandler(CSSPropertyMarginBottom, ApplyPropertyLength<&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
2152  setPropertyHandler(CSSPropertyMarginLeft, ApplyPropertyLength<&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
2153  setPropertyHandler(CSSPropertyMarginRight, ApplyPropertyLength<&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
2154  setPropertyHandler(CSSPropertyMarginTop, ApplyPropertyLength<&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
2155  setPropertyHandler(CSSPropertyMaxHeight, ApplyPropertyLength<&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
2156  setPropertyHandler(CSSPropertyMaxWidth, ApplyPropertyLength<&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler());
2157  setPropertyHandler(CSSPropertyMinHeight, ApplyPropertyLength<&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled>::createHandler());
2158  setPropertyHandler(CSSPropertyMinWidth, ApplyPropertyLength<&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled>::createHandler());
2159  setPropertyHandler(CSSPropertyOpacity, ApplyPropertyDefault<float, &RenderStyle::opacity, float, &RenderStyle::setOpacity, float, &RenderStyle::initialOpacity>::createHandler());
2160  setPropertyHandler(CSSPropertyOrphans, ApplyPropertyAuto<short, &RenderStyle::orphans, &RenderStyle::setOrphans, &RenderStyle::hasAutoOrphans, &RenderStyle::setHasAutoOrphans>::createHandler());
2161  setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
2162  setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler());
2163  setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
2164  setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialOutlineWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2165  setPropertyHandler(CSSPropertyOverflowWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
2166  setPropertyHandler(CSSPropertyOverflowX, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowX, EOverflow, &RenderStyle::setOverflowX, EOverflow, &RenderStyle::initialOverflowX>::createHandler());
2167  setPropertyHandler(CSSPropertyOverflowY, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowY, EOverflow, &RenderStyle::setOverflowY, EOverflow, &RenderStyle::initialOverflowY>::createHandler());
2168  setPropertyHandler(CSSPropertyPaddingBottom, ApplyPropertyLength<&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding>::createHandler());
2169  setPropertyHandler(CSSPropertyPaddingLeft, ApplyPropertyLength<&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding>::createHandler());
2170  setPropertyHandler(CSSPropertyPaddingRight, ApplyPropertyLength<&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding>::createHandler());
2171  setPropertyHandler(CSSPropertyPaddingTop, ApplyPropertyLength<&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding>::createHandler());
2172  setPropertyHandler(CSSPropertyPageBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakAfter, EPageBreak, &RenderStyle::setPageBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2173  setPropertyHandler(CSSPropertyPageBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakBefore, EPageBreak, &RenderStyle::setPageBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2174  setPropertyHandler(CSSPropertyPageBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakInside, EPageBreak, &RenderStyle::setPageBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2175  setPropertyHandler(CSSPropertyPointerEvents, ApplyPropertyDefault<EPointerEvents, &RenderStyle::pointerEvents, EPointerEvents, &RenderStyle::setPointerEvents, EPointerEvents, &RenderStyle::initialPointerEvents>::createHandler());
2176  setPropertyHandler(CSSPropertyPosition, ApplyPropertyDefault<EPosition, &RenderStyle::position, EPosition, &RenderStyle::setPosition, EPosition, &RenderStyle::initialPosition>::createHandler());
2177  setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
2178  setPropertyHandler(CSSPropertyRight, ApplyPropertyLength<&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
2179  setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler());
2180  setPropertyHandler(CSSPropertySpeak, ApplyPropertyDefault<ESpeak, &RenderStyle::speak, ESpeak, &RenderStyle::setSpeak, ESpeak, &RenderStyle::initialSpeak>::createHandler());
2181  setPropertyHandler(CSSPropertyTableLayout, ApplyPropertyDefault<ETableLayout, &RenderStyle::tableLayout, ETableLayout, &RenderStyle::setTableLayout, ETableLayout, &RenderStyle::initialTableLayout>::createHandler());
2182  setPropertyHandler(CSSPropertyTabSize, ApplyPropertyDefault<unsigned, &RenderStyle::tabSize, unsigned, &RenderStyle::setTabSize, unsigned, &RenderStyle::initialTabSize>::createHandler());
2183  setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
2184  setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler());
2185 #if ENABLE(CSS3_TEXT)
2186  setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler());
2187  setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault<TextDecorationStyle, &RenderStyle::textDecorationStyle, TextDecorationStyle, &RenderStyle::setTextDecorationStyle, TextDecorationStyle, &RenderStyle::initialTextDecorationStyle>::createHandler());
2188  setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
2189  setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<TextAlignLast, &RenderStyle::textAlignLast, TextAlignLast, &RenderStyle::setTextAlignLast, TextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler());
2190  setPropertyHandler(CSSPropertyWebkitTextJustify, ApplyPropertyDefault<TextJustify, &RenderStyle::textJustify, TextJustify, &RenderStyle::setTextJustify, TextJustify, &RenderStyle::initialTextJustify>::createHandler());
2191  setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
2192 #endif // CSS3_TEXT
2193  setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyTextIndent::createHandler());
2194  setPropertyHandler(CSSPropertyTextOverflow, ApplyPropertyDefault<TextOverflow, &RenderStyle::textOverflow, TextOverflow, &RenderStyle::setTextOverflow, TextOverflow, &RenderStyle::initialTextOverflow>::createHandler());
2195  setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
2196  setPropertyHandler(CSSPropertyTextTransform, ApplyPropertyDefault<ETextTransform, &RenderStyle::textTransform, ETextTransform, &RenderStyle::setTextTransform, ETextTransform, &RenderStyle::initialTextTransform>::createHandler());
2197  setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
2198  setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyDefault<EUnicodeBidi, &RenderStyle::unicodeBidi, EUnicodeBidi, &RenderStyle::setUnicodeBidi, EUnicodeBidi, &RenderStyle::initialUnicodeBidi>::createHandler());
2199  setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
2200  setPropertyHandler(CSSPropertyVisibility, ApplyPropertyDefault<EVisibility, &RenderStyle::visibility, EVisibility, &RenderStyle::setVisibility, EVisibility, &RenderStyle::initialVisibility>::createHandler());
2201  setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2202  setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation<Animation::AnimationDirection, &Animation::direction, &Animation::setDirection, &Animation::isDirectionSet, &Animation::clearDirection, &Animation::initialAnimationDirection, &CSSToStyleMap::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2203  setPropertyHandler(CSSPropertyWebkitAnimationDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2204  setPropertyHandler(CSSPropertyWebkitAnimationFillMode, ApplyPropertyAnimation<unsigned, &Animation::fillMode, &Animation::setFillMode, &Animation::isFillModeSet, &Animation::clearFillMode, &Animation::initialAnimationFillMode, &CSSToStyleMap::mapAnimationFillMode, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2205  setPropertyHandler(CSSPropertyWebkitAnimationIterationCount, ApplyPropertyAnimation<double, &Animation::iterationCount, &Animation::setIterationCount, &Animation::isIterationCountSet, &Animation::clearIterationCount, &Animation::initialAnimationIterationCount, &CSSToStyleMap::mapAnimationIterationCount, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2206  setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation<const String&, &Animation::name, &Animation::setName, &Animation::isNameSet, &Animation::clearName, &Animation::initialAnimationName, &CSSToStyleMap::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2207  setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation<EAnimPlayState, &Animation::playState, &Animation::setPlayState, &Animation::isPlayStateSet, &Animation::clearPlayState, &Animation::initialAnimationPlayState, &CSSToStyleMap::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2208  setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2209  setPropertyHandler(CSSPropertyWebkitAppearance, ApplyPropertyDefault<ControlPart, &RenderStyle::appearance, ControlPart, &RenderStyle::setAppearance, ControlPart, &RenderStyle::initialAppearance>::createHandler());
2210  setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler());
2211  setPropertyHandler(CSSPropertyWebkitBackfaceVisibility, ApplyPropertyDefault<EBackfaceVisibility, &RenderStyle::backfaceVisibility, EBackfaceVisibility, &RenderStyle::setBackfaceVisibility, EBackfaceVisibility, &RenderStyle::initialBackfaceVisibility>::createHandler());
2212  setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
2213  setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
2214  setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
2215  setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
2216 #if ENABLE(CSS_COMPOSITING)
2217  setPropertyHandler(CSSPropertyWebkitBlendMode, ApplyPropertyDefault<BlendMode, &RenderStyle::blendMode, BlendMode, &RenderStyle::setBlendMode, BlendMode, &RenderStyle::initialBlendMode>::createHandler());
2218  setPropertyHandler(CSSPropertyWebkitBackgroundBlendMode, ApplyPropertyFillLayer<BlendMode, CSSPropertyWebkitBackgroundBlendMode, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isBlendModeSet, &FillLayer::blendMode, &FillLayer::setBlendMode, &FillLayer::clearBlendMode, &FillLayer::initialFillBlendMode, &CSSToStyleMap::mapFillBlendMode>::createHandler());
2219 #endif
2220  setPropertyHandler(CSSPropertyWebkitBorderFit, ApplyPropertyDefault<EBorderFit, &RenderStyle::borderFit, EBorderFit, &RenderStyle::setBorderFit, EBorderFit, &RenderStyle::initialBorderFit>::createHandler());
2221  setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing>::createHandler());
2222  setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage<BorderImage, CSSPropertyWebkitBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage>::createHandler());
2223  setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing>::createHandler());
2224  setPropertyHandler(CSSPropertyWebkitBoxAlign, ApplyPropertyDefault<EBoxAlignment, &RenderStyle::boxAlign, EBoxAlignment, &RenderStyle::setBoxAlign, EBoxAlignment, &RenderStyle::initialBoxAlign>::createHandler());
2225 #if ENABLE(CSS_BOX_DECORATION_BREAK)
2226  setPropertyHandler(CSSPropertyWebkitBoxDecorationBreak, ApplyPropertyDefault<EBoxDecorationBreak, &RenderStyle::boxDecorationBreak, EBoxDecorationBreak, &RenderStyle::setBoxDecorationBreak, EBoxDecorationBreak, &RenderStyle::initialBoxDecorationBreak>::createHandler());
2227 #endif
2228  setPropertyHandler(CSSPropertyWebkitBoxDirection, ApplyPropertyDefault<EBoxDirection, &RenderStyle::boxDirection, EBoxDirection, &RenderStyle::setBoxDirection, EBoxDirection, &RenderStyle::initialBoxDirection>::createHandler());
2229  setPropertyHandler(CSSPropertyWebkitBoxFlex, ApplyPropertyDefault<float, &RenderStyle::boxFlex, float, &RenderStyle::setBoxFlex, float, &RenderStyle::initialBoxFlex>::createHandler());
2230  setPropertyHandler(CSSPropertyWebkitBoxFlexGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxFlexGroup, unsigned int, &RenderStyle::setBoxFlexGroup, unsigned int, &RenderStyle::initialBoxFlexGroup>::createHandler());
2231  setPropertyHandler(CSSPropertyWebkitBoxLines, ApplyPropertyDefault<EBoxLines, &RenderStyle::boxLines, EBoxLines, &RenderStyle::setBoxLines, EBoxLines, &RenderStyle::initialBoxLines>::createHandler());
2232  setPropertyHandler(CSSPropertyWebkitBoxOrdinalGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxOrdinalGroup, unsigned int, &RenderStyle::setBoxOrdinalGroup, unsigned int, &RenderStyle::initialBoxOrdinalGroup>::createHandler());
2233  setPropertyHandler(CSSPropertyWebkitBoxOrient, ApplyPropertyDefault<EBoxOrient, &RenderStyle::boxOrient, EBoxOrient, &RenderStyle::setBoxOrient, EBoxOrient, &RenderStyle::initialBoxOrient>::createHandler());
2234  setPropertyHandler(CSSPropertyWebkitBoxPack, ApplyPropertyDefault<EBoxPack, &RenderStyle::boxPack, EBoxPack, &RenderStyle::setBoxPack, EBoxPack, &RenderStyle::initialBoxPack>::createHandler());
2235  setPropertyHandler(CSSPropertyWebkitColorCorrection, ApplyPropertyDefault<ColorSpace, &RenderStyle::colorSpace, ColorSpace, &RenderStyle::setColorSpace, ColorSpace, &RenderStyle::initialColorSpace>::createHandler());
2236  setPropertyHandler(CSSPropertyWebkitColumnAxis, ApplyPropertyDefault<ColumnAxis, &RenderStyle::columnAxis, ColumnAxis, &RenderStyle::setColumnAxis, ColumnAxis, &RenderStyle::initialColumnAxis>::createHandler());
2237  setPropertyHandler(CSSPropertyWebkitColumnBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakAfter, EPageBreak, &RenderStyle::setColumnBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2238  setPropertyHandler(CSSPropertyWebkitColumnBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakBefore, EPageBreak, &RenderStyle::setColumnBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2239  setPropertyHandler(CSSPropertyWebkitColumnBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakInside, EPageBreak, &RenderStyle::setColumnBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2240  setPropertyHandler(CSSPropertyWebkitColumnCount, ApplyPropertyAuto<unsigned short, &RenderStyle::columnCount, &RenderStyle::setColumnCount, &RenderStyle::hasAutoColumnCount, &RenderStyle::setHasAutoColumnCount>::createHandler());
2241  setPropertyHandler(CSSPropertyWebkitColumnGap, ApplyPropertyAuto<float, &RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap, ComputeLength, CSSValueNormal>::createHandler());
2242  setPropertyHandler(CSSPropertyWebkitColumnProgression, ApplyPropertyDefault<ColumnProgression, &RenderStyle::columnProgression, ColumnProgression, &RenderStyle::setColumnProgression, ColumnProgression, &RenderStyle::initialColumnProgression>::createHandler());
2243  setPropertyHandler(CSSPropertyWebkitColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
2244  setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialColumnRuleWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2245  setPropertyHandler(CSSPropertyWebkitColumnSpan, ApplyPropertyDefault<ColumnSpan, &RenderStyle::columnSpan, ColumnSpan, &RenderStyle::setColumnSpan, ColumnSpan, &RenderStyle::initialColumnSpan>::createHandler());
2246  setPropertyHandler(CSSPropertyWebkitColumnRuleStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::columnRuleStyle, EBorderStyle, &RenderStyle::setColumnRuleStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2247  setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
2248 #if ENABLE(CURSOR_VISIBILITY)
2249  setPropertyHandler(CSSPropertyWebkitCursorVisibility, ApplyPropertyDefault<CursorVisibility, &RenderStyle::cursorVisibility, CursorVisibility, &RenderStyle::setCursorVisibility, CursorVisibility, &RenderStyle::initialCursorVisibility>::createHandler());
2250 #endif
2251  setPropertyHandler(CSSPropertyWebkitAlignContent, ApplyPropertyDefault<EAlignContent, &RenderStyle::alignContent, EAlignContent, &RenderStyle::setAlignContent, EAlignContent, &RenderStyle::initialAlignContent>::createHandler());
2252  setPropertyHandler(CSSPropertyWebkitAlignItems, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignItems, EAlignItems, &RenderStyle::setAlignItems, EAlignItems, &RenderStyle::initialAlignItems>::createHandler());
2253  setPropertyHandler(CSSPropertyWebkitAlignSelf, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignSelf, EAlignItems, &RenderStyle::setAlignSelf, EAlignItems, &RenderStyle::initialAlignSelf>::createHandler());
2254  setPropertyHandler(CSSPropertyWebkitFlexBasis, ApplyPropertyLength<&RenderStyle::flexBasis, &RenderStyle::setFlexBasis, &RenderStyle::initialFlexBasis, AutoEnabled>::createHandler());
2255  setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler());
2256  setPropertyHandler(CSSPropertyWebkitFlexGrow, ApplyPropertyDefault<float, &RenderStyle::flexGrow, float, &RenderStyle::setFlexGrow, float, &RenderStyle::initialFlexGrow>::createHandler());
2257  setPropertyHandler(CSSPropertyWebkitFlexShrink, ApplyPropertyDefault<float, &RenderStyle::flexShrink, float, &RenderStyle::setFlexShrink, float, &RenderStyle::initialFlexShrink>::createHandler());
2258  setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler());
2259  setPropertyHandler(CSSPropertyWebkitGridAutoFlow, ApplyPropertyDefault<GridAutoFlow, &RenderStyle::gridAutoFlow, GridAutoFlow, &RenderStyle::setGridAutoFlow, GridAutoFlow, &RenderStyle::initialGridAutoFlow>::createHandler());
2260  setPropertyHandler(CSSPropertyWebkitJustifyContent, ApplyPropertyDefault<EJustifyContent, &RenderStyle::justifyContent, EJustifyContent, &RenderStyle::setJustifyContent, EJustifyContent, &RenderStyle::initialJustifyContent>::createHandler());
2261  setPropertyHandler(CSSPropertyWebkitOrder, ApplyPropertyDefault<int, &RenderStyle::order, int, &RenderStyle::setOrder, int, &RenderStyle::initialOrder>::createHandler());
2262 #if ENABLE(CSS_REGIONS)
2263  setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler());
2264  setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapNoneToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler());
2265 #endif
2266  setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
2267  setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
2268  setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
2269  setPropertyHandler(CSSPropertyWebkitHighlight, ApplyPropertyString<MapNoneToNull, &RenderStyle::highlight, &RenderStyle::setHighlight, &RenderStyle::initialHighlight>::createHandler());
2270  setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, ApplyPropertyString<MapAutoToNull, &RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString>::createHandler());
2271  setPropertyHandler(CSSPropertyWebkitHyphenateLimitAfter, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitAfter, &RenderStyle::setHyphenationLimitAfter, &RenderStyle::initialHyphenationLimitAfter>::createHandler());
2272  setPropertyHandler(CSSPropertyWebkitHyphenateLimitBefore, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitBefore, &RenderStyle::setHyphenationLimitBefore, &RenderStyle::initialHyphenationLimitBefore>::createHandler());
2273  setPropertyHandler(CSSPropertyWebkitHyphenateLimitLines, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitLines, &RenderStyle::setHyphenationLimitLines, &RenderStyle::initialHyphenationLimitLines, CSSValueNoLimit>::createHandler());
2274  setPropertyHandler(CSSPropertyWebkitHyphens, ApplyPropertyDefault<Hyphens, &RenderStyle::hyphens, Hyphens, &RenderStyle::setHyphens, Hyphens, &RenderStyle::initialHyphens>::createHandler());
2275  setPropertyHandler(CSSPropertyWebkitLineAlign, ApplyPropertyDefault<LineAlign, &RenderStyle::lineAlign, LineAlign, &RenderStyle::setLineAlign, LineAlign, &RenderStyle::initialLineAlign>::createHandler());
2276  setPropertyHandler(CSSPropertyWebkitLineBreak, ApplyPropertyDefault<LineBreak, &RenderStyle::lineBreak, LineBreak, &RenderStyle::setLineBreak, LineBreak, &RenderStyle::initialLineBreak>::createHandler());
2277  setPropertyHandler(CSSPropertyWebkitLineClamp, ApplyPropertyDefault<const LineClampValue&, &RenderStyle::lineClamp, LineClampValue, &RenderStyle::setLineClamp, LineClampValue, &RenderStyle::initialLineClamp>::createHandler());
2278  setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString<MapNoneToNull, &RenderStyle::lineGrid, &RenderStyle::setLineGrid, &RenderStyle::initialLineGrid>::createHandler());
2279  setPropertyHandler(CSSPropertyWebkitLineSnap, ApplyPropertyDefault<LineSnap, &RenderStyle::lineSnap, LineSnap, &RenderStyle::setLineSnap, LineSnap, &RenderStyle::initialLineSnap>::createHandler());
2280  setPropertyHandler(CSSPropertyWebkitMarginAfterCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginAfterCollapse, EMarginCollapse, &RenderStyle::setMarginAfterCollapse, EMarginCollapse, &RenderStyle::initialMarginAfterCollapse>::createHandler());
2281  setPropertyHandler(CSSPropertyWebkitMarginBeforeCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginBeforeCollapse, EMarginCollapse, &RenderStyle::setMarginBeforeCollapse, EMarginCollapse, &RenderStyle::initialMarginBeforeCollapse>::createHandler());
2282  setPropertyHandler(CSSPropertyWebkitMarginBottomCollapse, CSSPropertyWebkitMarginAfterCollapse);
2283  setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse);
2284  setPropertyHandler(CSSPropertyWebkitMarqueeDirection, ApplyPropertyDefault<EMarqueeDirection, &RenderStyle::marqueeDirection, EMarqueeDirection, &RenderStyle::setMarqueeDirection, EMarqueeDirection, &RenderStyle::initialMarqueeDirection>::createHandler());
2285  setPropertyHandler(CSSPropertyWebkitMarqueeIncrement, ApplyPropertyMarqueeIncrement::createHandler());
2286  setPropertyHandler(CSSPropertyWebkitMarqueeRepetition, ApplyPropertyMarqueeRepetition::createHandler());
2287  setPropertyHandler(CSSPropertyWebkitMarqueeSpeed, ApplyPropertyMarqueeSpeed::createHandler());
2288  setPropertyHandler(CSSPropertyWebkitMarqueeStyle, ApplyPropertyDefault<EMarqueeBehavior, &RenderStyle::marqueeBehavior, EMarqueeBehavior, &RenderStyle::setMarqueeBehavior, EMarqueeBehavior, &RenderStyle::initialMarqueeBehavior>::createHandler());
2289  setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage<BorderMask, CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage>::createHandler());
2290  setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier<BorderMask, Outset>::createHandler());
2291  setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier<BorderMask, Repeat>::createHandler());
2292  setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier<BorderMask, Slice>::createHandler());
2293  setPropertyHandler(CSSPropertyWebkitMaskBoxImageSource, ApplyPropertyBorderImageSource<CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource, &RenderStyle::initialMaskBoxImageSource>::createHandler());
2294  setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier<BorderMask, Width>::createHandler());
2295  setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSToStyleMap::mapFillClip>::createHandler());
2296  setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
2297  setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSToStyleMap::mapFillImage>::createHandler());
2298  setPropertyHandler(CSSPropertyWebkitMaskOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSToStyleMap::mapFillOrigin>::createHandler());
2299  setPropertyHandler(CSSPropertyWebkitMaskPositionX, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSToStyleMap::mapFillXPosition>::createHandler());
2300  setPropertyHandler(CSSPropertyWebkitMaskPositionY, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSToStyleMap::mapFillYPosition>::createHandler());
2301  setPropertyHandler(CSSPropertyWebkitMaskRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSToStyleMap::mapFillRepeatX>::createHandler());
2302  setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler());
2303  setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
2304  setPropertyHandler(CSSPropertyWebkitNbspMode, ApplyPropertyDefault<ENBSPMode, &RenderStyle::nbspMode, ENBSPMode, &RenderStyle::setNBSPMode, ENBSPMode, &RenderStyle::initialNBSPMode>::createHandler());
2305  setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
2306  setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler());
2307  setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, ApplyPropertyLength<&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY>::createHandler());
2308  setPropertyHandler(CSSPropertyWebkitPrintColorAdjust, ApplyPropertyDefault<PrintColorAdjust, &RenderStyle::printColorAdjust, PrintColorAdjust, &RenderStyle::setPrintColorAdjust, PrintColorAdjust, &RenderStyle::initialPrintColorAdjust>::createHandler());
2309 #if ENABLE(CSS_REGIONS)
2310  setPropertyHandler(CSSPropertyWebkitRegionBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakAfter, EPageBreak, &RenderStyle::setRegionBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2311  setPropertyHandler(CSSPropertyWebkitRegionBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakBefore, EPageBreak, &RenderStyle::setRegionBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2312  setPropertyHandler(CSSPropertyWebkitRegionBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakInside, EPageBreak, &RenderStyle::setRegionBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2313  setPropertyHandler(CSSPropertyWebkitRegionOverflow, ApplyPropertyDefault<RegionOverflow, &RenderStyle::regionOverflow, RegionOverflow, &RenderStyle::setRegionOverflow, RegionOverflow, &RenderStyle::initialRegionOverflow>::createHandler());
2314 #endif
2315  setPropertyHandler(CSSPropertyWebkitRtlOrdering, ApplyPropertyDefault<Order, &RenderStyle::rtlOrdering, Order, &RenderStyle::setRTLOrdering, Order, &RenderStyle::initialRTLOrdering>::createHandler());
2316  setPropertyHandler(CSSPropertyWebkitRubyPosition, ApplyPropertyDefault<RubyPosition, &RenderStyle::rubyPosition, RubyPosition, &RenderStyle::setRubyPosition, RubyPosition, &RenderStyle::initialRubyPosition>::createHandler());
2317  setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault<TextCombine, &RenderStyle::textCombine, TextCombine, &RenderStyle::setTextCombine, TextCombine, &RenderStyle::initialTextCombine>::createHandler());
2318  setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
2319  setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyDefault<TextEmphasisPosition, &RenderStyle::textEmphasisPosition, TextEmphasisPosition, &RenderStyle::setTextEmphasisPosition, TextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition>::createHandler());
2320  setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler());
2321  setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler());
2322  setPropertyHandler(CSSPropertyWebkitTextSecurity, ApplyPropertyDefault<ETextSecurity, &RenderStyle::textSecurity, ETextSecurity, &RenderStyle::setTextSecurity, ETextSecurity, &RenderStyle::initialTextSecurity>::createHandler());
2323  setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color>::createHandler());
2324  setPropertyHandler(CSSPropertyWebkitTransformOriginX, ApplyPropertyLength<&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX>::createHandler());
2325  setPropertyHandler(CSSPropertyWebkitTransformOriginY, ApplyPropertyLength<&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY>::createHandler());
2326  setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength<float, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ>::createHandler());
2327  setPropertyHandler(CSSPropertyWebkitTransformStyle, ApplyPropertyDefault<ETransformStyle3D, &RenderStyle::transformStyle3D, ETransformStyle3D, &RenderStyle::setTransformStyle3D, ETransformStyle3D, &RenderStyle::initialTransformStyle3D>::createHandler());
2328  setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
2329  setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
2330  setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation<CSSPropertyID, &Animation::property, &Animation::setProperty, &Animation::isPropertySet, &Animation::clearProperty, &Animation::initialAnimationProperty, &CSSToStyleMap::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
2331  setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
2332  setPropertyHandler(CSSPropertyWebkitUserDrag, ApplyPropertyDefault<EUserDrag, &RenderStyle::userDrag, EUserDrag, &RenderStyle::setUserDrag, EUserDrag, &RenderStyle::initialUserDrag>::createHandler());
2333  setPropertyHandler(CSSPropertyWebkitUserModify, ApplyPropertyDefault<EUserModify, &RenderStyle::userModify, EUserModify, &RenderStyle::setUserModify, EUserModify, &RenderStyle::initialUserModify>::createHandler());
2334  setPropertyHandler(CSSPropertyWebkitUserSelect, ApplyPropertyDefault<EUserSelect, &RenderStyle::userSelect, EUserSelect, &RenderStyle::setUserSelect, EUserSelect, &RenderStyle::initialUserSelect>::createHandler());
2335  setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderStyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::createHandler());
2336 
2337 #if ENABLE(CSS_EXCLUSIONS)
2338  setPropertyHandler(CSSPropertyWebkitWrapFlow, ApplyPropertyDefault<WrapFlow, &RenderStyle::wrapFlow, WrapFlow, &RenderStyle::setWrapFlow, WrapFlow, &RenderStyle::initialWrapFlow>::createHandler());
2339  setPropertyHandler(CSSPropertyWebkitShapeMargin, ApplyPropertyLength<&RenderStyle::shapeMargin, &RenderStyle::setShapeMargin, &RenderStyle::initialShapeMargin>::createHandler());
2340  setPropertyHandler(CSSPropertyWebkitShapePadding, ApplyPropertyLength<&RenderStyle::shapePadding, &RenderStyle::setShapePadding, &RenderStyle::initialShapePadding>::createHandler());
2341  setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault<WrapThrough, &RenderStyle::wrapThrough, WrapThrough, &RenderStyle::setWrapThrough, WrapThrough, &RenderStyle::initialWrapThrough>::createHandler());
2342  setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyExclusionShape<&RenderStyle::shapeInside, &RenderStyle::setShapeInside, &RenderStyle::initialShapeInside>::createHandler());
2343  setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyExclusionShape<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initialShapeOutside>::createHandler());
2344 #endif
2345  setPropertyHandler(CSSPropertyWhiteSpace, ApplyPropertyDefault<EWhiteSpace, &RenderStyle::whiteSpace, EWhiteSpace, &RenderStyle::setWhiteSpace, EWhiteSpace, &RenderStyle::initialWhiteSpace>::createHandler());
2346  setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
2347  setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
2348  setPropertyHandler(CSSPropertyWordBreak, ApplyPropertyDefault<EWordBreak, &RenderStyle::wordBreak, EWordBreak, &RenderStyle::setWordBreak, EWordBreak, &RenderStyle::initialWordBreak>::createHandler());
2349  setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
2350  // UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
2351  setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
2352  setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
2353  setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
2354 }
2355 
2356 
2357 }

Source/WebCore/css/StyleBuilder.h

1 /*
2  * Copyright (C) 2011 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16  * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24 
25 #ifndef StyleBuilder_h
26 #define StyleBuilder_h
27 
28 #include "CSSPropertyNames.h"
29 #include "StylePropertyShorthand.h"
30 #include <wtf/PassRefPtr.h>
31 #include <wtf/RefCounted.h>
32 
33 namespace WebCore {
34 
35 class CSSValue;
36 class StyleBuilder;
37 class StyleResolver;
38 
39 class PropertyHandler {
40 public:
41  typedef void (*InheritFunction)(CSSPropertyID, StyleResolver*);
42  typedef void (*InitialFunction)(CSSPropertyID, StyleResolver*);
43  typedef void (*ApplyFunction)(CSSPropertyID, StyleResolver*, CSSValue*);
44  PropertyHandler() : m_inherit(0), m_initial(0), m_apply(0) { }
45  PropertyHandler(InheritFunction inherit, InitialFunction initial, ApplyFunction apply) : m_inherit(inherit), m_initial(initial), m_apply(apply) { }
46  void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) const { ASSERT(m_inherit); (*m_inherit)(propertyID, styleResolver); }
47  void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) const { ASSERT(m_initial); (*m_initial)(propertyID, styleResolver); }
48  void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) const { ASSERT(m_apply); (*m_apply)(propertyID, styleResolver, value); }
49  bool isValid() const { return m_inherit && m_initial && m_apply; }
50  InheritFunction inheritFunction() const { return m_inherit; }
51  InitialFunction initialFunction() { return m_initial; }
52  ApplyFunction applyFunction() { return m_apply; }
53 private:
54  InheritFunction m_inherit;
55  InitialFunction m_initial;
56  ApplyFunction m_apply;
57 };
58 
59 class StyleBuilder {
60  WTF_MAKE_NONCOPYABLE(StyleBuilder); WTF_MAKE_FAST_ALLOCATED;
61 public:
62  static const StyleBuilder& sharedStyleBuilder();
63 
64  const PropertyHandler& propertyHandler(CSSPropertyID property) const
65  {
66  ASSERT(valid(property));
67  return m_propertyMap[index(property)];
68  }
69 private:
70  StyleBuilder();
71  static int index(CSSPropertyID property)
72  {
73  return property - firstCSSProperty;
74  }
75 
76  static bool valid(CSSPropertyID property)
77  {
78  int i = index(property);
79  return i >= 0 && i < numCSSProperties;
80  }
81 
82  void setPropertyHandler(CSSPropertyID property, const PropertyHandler& handler)
83  {
84  ASSERT(valid(property));
85  ASSERT(!propertyHandler(property).isValid());
86  ASSERT_WITH_MESSAGE(!isExpandedShorthand(property), "Shorthand property id = %d shouldn't be inserted into StyleBuilder. Shorthands should be expanded at parsing time.", property);
87  m_propertyMap[index(property)] = handler;
88  }
89 
90  void setPropertyHandler(CSSPropertyID newProperty, CSSPropertyID equivalentProperty)
91  {
92  ASSERT(valid(newProperty));
93  ASSERT(valid(equivalentProperty));
94  ASSERT(!propertyHandler(newProperty).isValid());
95  ASSERT_WITH_MESSAGE(!isExpandedShorthand(newProperty), "Shorthand property id = %d shouldn't be inserted into StyleBuilder. Shorthands should be expanded at parsing time.", newProperty);
96  ASSERT_WITH_MESSAGE(!isExpandedShorthand(equivalentProperty), "Shorthand property id = %d shouldn't be inserted into StyleBuilder. Shorthands should be expanded at parsing time.", equivalentProperty);
97  m_propertyMap[index(newProperty)] = m_propertyMap[index(equivalentProperty)];
98  }
99 
100  PropertyHandler m_propertyMap[numCSSProperties];
101 };
102 
103 }
104 
105 #endif // StyleBuilder_h

Source/WebCore/css/StyleResolver.cpp

5858#include "Counter.h"
5959#include "CounterContent.h"
6060#include "CursorList.h"
 61#include "DeprecatedStyleBuilder.h"
6162#include "DocumentStyleSheetCollection.h"
6263#include "ElementRuleCollector.h"
6364#include "ElementShadow.h"

110111#include "ShadowRoot.h"
111112#include "ShadowValue.h"
112113#include "SkewTransformOperation.h"
113 #include "StyleBuilder.h"
114114#include "StyleCachedImage.h"
115115#include "StyleGeneratedImage.h"
116116#include "StylePendingImage.h"

@@StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles)
258258#if ENABLE(CSS_DEVICE_ADAPTATION)
259259 , m_viewportStyleResolver(ViewportStyleResolver::create(document))
260260#endif
261  , m_styleBuilder(StyleBuilder::sharedStyleBuilder())
 261 , m_deprecatedStyleBuilder(DeprecatedStyleBuilder::sharedStyleBuilder())
262262 , m_styleMap(this)
263263{
264264 Element* root = document->documentElement();

@@void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
22482248#endif
22492249
22502250 // Check lookup table for implementations and use when available.
2251  const PropertyHandler& handler = m_styleBuilder.propertyHandler(id);
 2251 const PropertyHandler& handler = m_deprecatedStyleBuilder.propertyHandler(id);
22522252 if (handler.isValid()) {
22532253 if (isInherit)
22542254 handler.applyInheritValue(id, this);

@@void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
28902890 return;
28912891 }
28922892
2893  // These properties are aliased and StyleBuilder already applied the property on the prefixed version.
 2893 // These properties are aliased and DeprecatedStyleBuilder already applied the property on the prefixed version.
28942894 case CSSPropertyTransitionDelay:
28952895 case CSSPropertyTransitionDuration:
28962896 case CSSPropertyTransitionProperty:
28972897 case CSSPropertyTransitionTimingFunction:
28982898 return;
2899  // These properties are implemented in the StyleBuilder lookup table.
 2899 // These properties are implemented in the DeprecatedStyleBuilder lookup table.
29002900 case CSSPropertyBackgroundAttachment:
29012901 case CSSPropertyBackgroundClip:
29022902 case CSSPropertyBackgroundColor:

@@void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
45234523
45244524 info.addMember(m_fontSelector, "fontSelector");
45254525 info.addMember(m_viewportDependentMediaQueryResults, "viewportDependentMediaQueryResults");
4526  info.ignoreMember(m_styleBuilder);
 4526 info.ignoreMember(m_deprecatedStyleBuilder);
45274527 info.addMember(m_inspectorCSSOMWrappers);
45284528 info.addMember(m_scopeResolver, "scopeResolver");
45294529

Source/WebCore/css/StyleResolver.h

@@class CustomFilterParameterList;
7878class CustomFilterProgram;
7979struct CustomFilterProgramMixSettings;
8080class Document;
 81class DeprecatedStyleBuilder;
8182class Element;
8283class Frame;
8384class FrameView;

@@class RuleSet;
9394class Settings;
9495class StaticCSSRuleList;
9596class StyleCustomFilterProgramCache;
96 class StyleBuilder;
9797class StyleScopeResolver;
9898class StyleImage;
9999class StyleKeyframe;

@@private:
631631 RefPtr<ViewportStyleResolver> m_viewportStyleResolver;
632632#endif
633633
634  const StyleBuilder& m_styleBuilder;
 634 const DeprecatedStyleBuilder& m_deprecatedStyleBuilder;
635635
636636 OwnPtr<StyleScopeResolver> m_scopeResolver;
637637 CSSToStyleMap m_styleMap;

@@private:
643643 OwnPtr<StyleCustomFilterProgramCache> m_customFilterProgramCache;
644644#endif
645645
646  friend class StyleBuilder;
 646 friend class DeprecatedStyleBuilder;
647647 friend bool operator==(const MatchedProperties&, const MatchedProperties&);
648648 friend bool operator!=(const MatchedProperties&, const MatchedProperties&);
649649 friend bool operator==(const MatchRanges&, const MatchRanges&);

Source/WebCore/rendering/style/RenderStyle.h

@@typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
124124class RenderStyle: public RefCounted<RenderStyle> {
125125 friend class CSSPropertyAnimation; // Used by CSS animations. We can't allow them to animate based off visited colors.
126126 friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
 127 friend class DeprecatedStyleBuilder; // Sets members directly.
127128 friend class EditingStyle; // Editing has to only reveal unvisited info.
128129 friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info.
129130 friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
130131 friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
131132 friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors. Rebaselining would allow this to be yanked.
132  friend class StyleBuilder; // Sets members directly.
133133 friend class StyleResolver; // Sets members directly.
134134protected:
135135