Merge from Chromium at DEPS revision r200144

This commit was generated by merge_to_master.py.

Change-Id: I52995489013675af682cee321f417f624396b584
diff --git a/Source/core/OWNERS b/Source/core/OWNERS
index ebc9955..b3766bb 100644
--- a/Source/core/OWNERS
+++ b/Source/core/OWNERS
@@ -1,6 +1,7 @@
 abarth@chromium.org
 alexis.menard@intel.com
 apavlov@chromium.org
+arv@chromium.org
 crogers@google.com
 darin@chromium.org
 dglazkov@chromium.org
diff --git a/Source/core/animation/DocumentTimeline.cpp b/Source/core/animation/DocumentTimeline.cpp
index 663d8ea..e103589 100644
--- a/Source/core/animation/DocumentTimeline.cpp
+++ b/Source/core/animation/DocumentTimeline.cpp
@@ -56,7 +56,7 @@
         m_document->view()->scheduleAnimation();
 }
 
-TimedItem::ChildAnimationState DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime)
+void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime)
 {
     Vector<size_t> expiredIndices;
 
@@ -70,8 +70,6 @@
 
     if (m_document->view())
         m_document->view()->scheduleAnimation();
-
-    return AnimationInProgress;
 }
 
 } // namespace
diff --git a/Source/core/animation/DocumentTimeline.h b/Source/core/animation/DocumentTimeline.h
index 30684b5..de520bd 100644
--- a/Source/core/animation/DocumentTimeline.h
+++ b/Source/core/animation/DocumentTimeline.h
@@ -41,11 +41,11 @@
 class Element;
 
 // DocumentTimeline is constructed and owned by Document, and tied to its lifecycle.
-class DocumentTimeline FINAL : public TimedItem {
+class DocumentTimeline : public RefCounted<DocumentTimeline> {
 
 public:
     static PassRefPtr<DocumentTimeline> create(Document*);
-    virtual TimedItem::ChildAnimationState serviceAnimations(double) OVERRIDE FINAL;
+    void serviceAnimations(double);
     void play(PassRefPtr<TimedItem>);
 
 private:
diff --git a/Source/core/tests/DocumentTimeline.cpp b/Source/core/animation/DocumentTimelineTest.cpp
similarity index 100%
rename from Source/core/tests/DocumentTimeline.cpp
rename to Source/core/animation/DocumentTimelineTest.cpp
diff --git a/Source/core/core.gyp/core.gyp b/Source/core/core.gyp/core.gyp
index a237668..fea1b1c 100644
--- a/Source/core/core.gyp/core.gyp
+++ b/Source/core/core.gyp/core.gyp
@@ -317,7 +317,7 @@
         '../../Platform/Platform.gyp/Platform.gyp:webkit_platform',
         '../../wtf/wtf.gyp:wtf',
         '../../config.gyp:config',
-        '../../origin/origin.gyp:origin',
+        '../../weborigin/weborigin.gyp:weborigin',
         '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl',
         '<(DEPTH)/gpu/gpu.gyp:gles2_c_lib',
         '<(DEPTH)/skia/skia.gyp:skia',
diff --git a/Source/core/core.gyp/core_derived_sources.gyp b/Source/core/core.gyp/core_derived_sources.gyp
index 6edbe64..98a2671 100644
--- a/Source/core/core.gyp/core_derived_sources.gyp
+++ b/Source/core/core.gyp/core_derived_sources.gyp
@@ -67,6 +67,8 @@
             '<@(scripts_for_in_files)',
             '../scripts/make_internal_runtime_flags.py',
             '../page/RuntimeEnabledFeatures.in',
+            '../scripts/templates/InternalRuntimeFlags.h.tmpl',
+            '../scripts/templates/InternalRuntimeFlags.idl.tmpl',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalRuntimeFlags.idl',
@@ -172,6 +174,8 @@
             '<@(scripts_for_in_files)',
             '../scripts/make_runtime_features.py',
             '../page/RuntimeEnabledFeatures.in',
+            '../scripts/templates/RuntimeEnabledFeatures.cpp.tmpl',
+            '../scripts/templates/RuntimeEnabledFeatures.h.tmpl',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/RuntimeEnabledFeatures.cpp',
@@ -420,15 +424,14 @@
               '../css/make-css-file-arrays.pl',
               '../scripts/preprocessor.pm',
             ],
-            # The .css files are in the same order as ../DerivedSources.make.
             'stylesheets': [
               '../css/html.css',
               '../css/quirks.css',
               '../css/view-source.css',
-              '../css/themeChromium.css', # Chromium only.
-              '../css/themeChromiumAndroid.css', # Chromium only.
-              '../css/themeChromiumLinux.css', # Chromium only.
-              '../css/themeChromiumSkia.css',  # Chromium only.
+              '../css/themeChromium.css',
+              '../css/themeChromiumAndroid.css',
+              '../css/themeChromiumLinux.css',
+              '../css/themeChromiumSkia.css',
               '../css/themeWin.css',
               '../css/themeWinQuirks.css',
               '../css/svg.css',
@@ -437,7 +440,6 @@
               '../css/mediaControlsChromium.css',
               '../css/mediaControlsChromiumAndroid.css',
               '../css/fullscreen.css',
-              # Skip fullscreenQuickTime.
             ],
           },
           'inputs': [
diff --git a/Source/core/core.gyp/generate_test_support_idls.target.darwin-arm.mk b/Source/core/core.gyp/generate_test_support_idls.target.darwin-arm.mk
index b0bd468..74bacee 100644
--- a/Source/core/core.gyp/generate_test_support_idls.target.darwin-arm.mk
+++ b/Source/core/core.gyp/generate_test_support_idls.target.darwin-arm.mk
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_internal_runtime_flags.py ../page/RuntimeEnabledFeatures.in "$(gyp_shared_intermediate_dir)/webkit/"
 
diff --git a/Source/core/core.gyp/generate_test_support_idls.target.darwin-x86.mk b/Source/core/core.gyp/generate_test_support_idls.target.darwin-x86.mk
index b0bd468..74bacee 100644
--- a/Source/core/core.gyp/generate_test_support_idls.target.darwin-x86.mk
+++ b/Source/core/core.gyp/generate_test_support_idls.target.darwin-x86.mk
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_internal_runtime_flags.py ../page/RuntimeEnabledFeatures.in "$(gyp_shared_intermediate_dir)/webkit/"
 
diff --git a/Source/core/core.gyp/generate_test_support_idls.target.linux-arm.mk b/Source/core/core.gyp/generate_test_support_idls.target.linux-arm.mk
index b0bd468..74bacee 100644
--- a/Source/core/core.gyp/generate_test_support_idls.target.linux-arm.mk
+++ b/Source/core/core.gyp/generate_test_support_idls.target.linux-arm.mk
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_internal_runtime_flags.py ../page/RuntimeEnabledFeatures.in "$(gyp_shared_intermediate_dir)/webkit/"
 
diff --git a/Source/core/core.gyp/generate_test_support_idls.target.linux-x86.mk b/Source/core/core.gyp/generate_test_support_idls.target.linux-x86.mk
index b0bd468..74bacee 100644
--- a/Source/core/core.gyp/generate_test_support_idls.target.linux-x86.mk
+++ b/Source/core/core.gyp/generate_test_support_idls.target.linux-x86.mk
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_internal_runtime_flags.py ../page/RuntimeEnabledFeatures.in "$(gyp_shared_intermediate_dir)/webkit/"
 
diff --git a/Source/core/core.gyp/make_derived_sources.target.darwin-arm.mk b/Source/core/core.gyp/make_derived_sources.target.darwin-arm.mk
index d07660b..ff8d0ae 100644
--- a/Source/core/core.gyp/make_derived_sources.target.darwin-arm.mk
+++ b/Source/core/core.gyp/make_derived_sources.target.darwin-arm.mk
@@ -59,7 +59,7 @@
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_runtime_features.py ../page/RuntimeEnabledFeatures.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_css_property_names.py ../css/CSSPropertyNames.in ../css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_css_property_names.py ../css/CSSPropertyNames.in ../css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -83,7 +83,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/makevalues.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_cssvaluekeywords.py "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp" "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h" -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" -- ../css/makevalues.pl ../css/CSSValueKeywords.in ../css/SVGCSSValueKeywords.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_cssvaluekeywords.py "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp" "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h" -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" -- ../css/makevalues.pl ../css/CSSValueKeywords.in ../css/SVGCSSValueKeywords.in
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -94,7 +94,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../html/HTMLTagNames.in ../html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../html/HTMLTagNames.in ../html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -119,7 +119,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/svgtags.in ../svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/svgtags.in ../svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -132,7 +132,7 @@
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/Event.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/Event.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_event_factory.py ../dom/EventNames.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -144,7 +144,7 @@
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_event_factory.py ../dom/EventTargetFactory.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -155,7 +155,7 @@
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_dom_exceptions.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/DOMExceptions.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_dom_exceptions.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/DOMExceptions.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_ExceptionCodeDescription ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_dom_exceptions.py ../dom/DOMExceptions.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -170,7 +170,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../mathml/mathtags.in ../mathml/mathattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../mathml/mathtags.in ../mathml/mathattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
@@ -183,7 +183,7 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" ../css/html.css ../css/quirks.css ../css/view-source.css ../css/themeChromium.css ../css/themeChromiumAndroid.css ../css/themeChromiumLinux.css ../css/themeChromiumSkia.css ../css/themeWin.css ../css/themeWinQuirks.css ../css/svg.css ../css/mathml.css ../css/mediaControls.css ../css/mediaControlsChromium.css ../css/mediaControlsChromiumAndroid.css ../css/fullscreen.css -- ../css/make-css-file-arrays.pl ../scripts/preprocessor.pm -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" ../css/html.css ../css/quirks.css ../css/view-source.css ../css/themeChromium.css ../css/themeChromiumAndroid.css ../css/themeChromiumLinux.css ../css/themeChromiumSkia.css ../css/themeWin.css ../css/themeWinQuirks.css ../css/svg.css ../css/mathml.css ../css/mediaControls.css ../css/mediaControlsChromium.css ../css/mediaControlsChromiumAndroid.css ../css/fullscreen.css -- ../css/make-css-file-arrays.pl ../scripts/preprocessor.pm -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
@@ -227,7 +227,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/xlinkattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/xlinkattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -238,7 +238,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -249,7 +249,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -260,7 +260,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -I../scripts ../css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" ../css/CSSGrammar.y.in ../css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -I../scripts ../css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" ../css/CSSGrammar.y.in ../css/CSSGrammar.y.includes
 
 
 
diff --git a/Source/core/core.gyp/make_derived_sources.target.darwin-x86.mk b/Source/core/core.gyp/make_derived_sources.target.darwin-x86.mk
index 5daf658..3aa3c9a 100644
--- a/Source/core/core.gyp/make_derived_sources.target.darwin-x86.mk
+++ b/Source/core/core.gyp/make_derived_sources.target.darwin-x86.mk
@@ -59,7 +59,7 @@
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_runtime_features.py ../page/RuntimeEnabledFeatures.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_css_property_names.py ../css/CSSPropertyNames.in ../css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_css_property_names.py ../css/CSSPropertyNames.in ../css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -83,7 +83,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/makevalues.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_cssvaluekeywords.py "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp" "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h" -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" -- ../css/makevalues.pl ../css/CSSValueKeywords.in ../css/SVGCSSValueKeywords.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_cssvaluekeywords.py "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp" "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h" -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" -- ../css/makevalues.pl ../css/CSSValueKeywords.in ../css/SVGCSSValueKeywords.in
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -94,7 +94,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../html/HTMLTagNames.in ../html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../html/HTMLTagNames.in ../html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -119,7 +119,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/svgtags.in ../svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/svgtags.in ../svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -132,7 +132,7 @@
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/Event.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/Event.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_event_factory.py ../dom/EventNames.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -144,7 +144,7 @@
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_event_factory.py ../dom/EventTargetFactory.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -155,7 +155,7 @@
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_dom_exceptions.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/DOMExceptions.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_dom_exceptions.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/DOMExceptions.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_ExceptionCodeDescription ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_dom_exceptions.py ../dom/DOMExceptions.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -170,7 +170,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../mathml/mathtags.in ../mathml/mathattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../mathml/mathtags.in ../mathml/mathattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
@@ -183,7 +183,7 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" ../css/html.css ../css/quirks.css ../css/view-source.css ../css/themeChromium.css ../css/themeChromiumAndroid.css ../css/themeChromiumLinux.css ../css/themeChromiumSkia.css ../css/themeWin.css ../css/themeWinQuirks.css ../css/svg.css ../css/mathml.css ../css/mediaControls.css ../css/mediaControlsChromium.css ../css/mediaControlsChromiumAndroid.css ../css/fullscreen.css -- ../css/make-css-file-arrays.pl ../scripts/preprocessor.pm -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" ../css/html.css ../css/quirks.css ../css/view-source.css ../css/themeChromium.css ../css/themeChromiumAndroid.css ../css/themeChromiumLinux.css ../css/themeChromiumSkia.css ../css/themeWin.css ../css/themeWinQuirks.css ../css/svg.css ../css/mathml.css ../css/mediaControls.css ../css/mediaControlsChromium.css ../css/mediaControlsChromiumAndroid.css ../css/fullscreen.css -- ../css/make-css-file-arrays.pl ../scripts/preprocessor.pm -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
@@ -227,7 +227,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/xlinkattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/xlinkattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -238,7 +238,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -249,7 +249,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -260,7 +260,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -I../scripts ../css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" ../css/CSSGrammar.y.in ../css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -I../scripts ../css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" ../css/CSSGrammar.y.in ../css/CSSGrammar.y.includes
 
 
 
diff --git a/Source/core/core.gyp/make_derived_sources.target.linux-arm.mk b/Source/core/core.gyp/make_derived_sources.target.linux-arm.mk
index d07660b..ff8d0ae 100644
--- a/Source/core/core.gyp/make_derived_sources.target.linux-arm.mk
+++ b/Source/core/core.gyp/make_derived_sources.target.linux-arm.mk
@@ -59,7 +59,7 @@
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_runtime_features.py ../page/RuntimeEnabledFeatures.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_css_property_names.py ../css/CSSPropertyNames.in ../css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_css_property_names.py ../css/CSSPropertyNames.in ../css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -83,7 +83,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/makevalues.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_cssvaluekeywords.py "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp" "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h" -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" -- ../css/makevalues.pl ../css/CSSValueKeywords.in ../css/SVGCSSValueKeywords.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_cssvaluekeywords.py "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp" "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h" -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" -- ../css/makevalues.pl ../css/CSSValueKeywords.in ../css/SVGCSSValueKeywords.in
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -94,7 +94,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../html/HTMLTagNames.in ../html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../html/HTMLTagNames.in ../html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -119,7 +119,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/svgtags.in ../svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/svgtags.in ../svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -132,7 +132,7 @@
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/Event.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/Event.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_event_factory.py ../dom/EventNames.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -144,7 +144,7 @@
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_event_factory.py ../dom/EventTargetFactory.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -155,7 +155,7 @@
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_dom_exceptions.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/DOMExceptions.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_dom_exceptions.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/DOMExceptions.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_ExceptionCodeDescription ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_dom_exceptions.py ../dom/DOMExceptions.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -170,7 +170,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../mathml/mathtags.in ../mathml/mathattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../mathml/mathtags.in ../mathml/mathattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
@@ -183,7 +183,7 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" ../css/html.css ../css/quirks.css ../css/view-source.css ../css/themeChromium.css ../css/themeChromiumAndroid.css ../css/themeChromiumLinux.css ../css/themeChromiumSkia.css ../css/themeWin.css ../css/themeWinQuirks.css ../css/svg.css ../css/mathml.css ../css/mediaControls.css ../css/mediaControlsChromium.css ../css/mediaControlsChromiumAndroid.css ../css/fullscreen.css -- ../css/make-css-file-arrays.pl ../scripts/preprocessor.pm -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" ../css/html.css ../css/quirks.css ../css/view-source.css ../css/themeChromium.css ../css/themeChromiumAndroid.css ../css/themeChromiumLinux.css ../css/themeChromiumSkia.css ../css/themeWin.css ../css/themeWinQuirks.css ../css/svg.css ../css/mathml.css ../css/mediaControls.css ../css/mediaControlsChromium.css ../css/mediaControlsChromiumAndroid.css ../css/fullscreen.css -- ../css/make-css-file-arrays.pl ../scripts/preprocessor.pm -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
@@ -227,7 +227,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/xlinkattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/xlinkattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -238,7 +238,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -249,7 +249,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -260,7 +260,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -I../scripts ../css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" ../css/CSSGrammar.y.in ../css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -I../scripts ../css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" ../css/CSSGrammar.y.in ../css/CSSGrammar.y.includes
 
 
 
diff --git a/Source/core/core.gyp/make_derived_sources.target.linux-x86.mk b/Source/core/core.gyp/make_derived_sources.target.linux-x86.mk
index 5daf658..3aa3c9a 100644
--- a/Source/core/core.gyp/make_derived_sources.target.linux-x86.mk
+++ b/Source/core/core.gyp/make_derived_sources.target.linux-x86.mk
@@ -59,7 +59,7 @@
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_runtime_features.py ../page/RuntimeEnabledFeatures.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_css_property_names.py ../css/CSSPropertyNames.in ../css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_css_property_names.py ../css/CSSPropertyNames.in ../css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -83,7 +83,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/makevalues.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_cssvaluekeywords.py "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp" "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h" -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" -- ../css/makevalues.pl ../css/CSSValueKeywords.in ../css/SVGCSSValueKeywords.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_cssvaluekeywords.py "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp" "$(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h" -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" -- ../css/makevalues.pl ../css/CSSValueKeywords.in ../css/SVGCSSValueKeywords.in
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -94,7 +94,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../html/HTMLTagNames.in ../html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../html/HTMLTagNames.in ../html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -119,7 +119,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/svgtags.in ../svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/svgtags.in ../svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -132,7 +132,7 @@
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/Event.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/Event.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_event_factory.py ../dom/EventNames.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -144,7 +144,7 @@
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_event_factory.py ../dom/EventTargetFactory.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -155,7 +155,7 @@
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: gyp_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: gyp_shared_intermediate_dir := $(GYP_ABS_ANDROID_TOP_DIR)/$(gyp_shared_intermediate_dir)
 $(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_dom_exceptions.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/DOMExceptions.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/DOMException.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_dom_exceptions.py $(LOCAL_PATH)/third_party/WebKit/Source/core/dom/DOMExceptions.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_ExceptionCodeDescription ($@)"
 	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python ../scripts/make_dom_exceptions.py ../dom/DOMExceptions.in "$(gyp_shared_intermediate_dir)/webkit/"
 
@@ -170,7 +170,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../mathml/mathtags.in ../mathml/mathattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../mathml/mathtags.in ../mathml/mathattrs.in -- --factory --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/MathMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
@@ -183,7 +183,7 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" ../css/html.css ../css/quirks.css ../css/view-source.css ../css/themeChromium.css ../css/themeChromiumAndroid.css ../css/themeChromiumLinux.css ../css/themeChromiumSkia.css ../css/themeWin.css ../css/themeWinQuirks.css ../css/svg.css ../css/mathml.css ../css/mediaControls.css ../css/mediaControlsChromium.css ../css/mediaControlsChromiumAndroid.css ../css/fullscreen.css -- ../css/make-css-file-arrays.pl ../scripts/preprocessor.pm -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" ../css/html.css ../css/quirks.css ../css/view-source.css ../css/themeChromium.css ../css/themeChromiumAndroid.css ../css/themeChromiumLinux.css ../css/themeChromiumSkia.css ../css/themeWin.css ../css/themeWinQuirks.css ../css/svg.css ../css/mathml.css ../css/mediaControls.css ../css/mediaControlsChromium.css ../css/mediaControlsChromiumAndroid.css ../css/fullscreen.css -- ../css/make-css-file-arrays.pl ../scripts/preprocessor.pm -- --defines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
@@ -227,7 +227,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/xlinkattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../svg/xlinkattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -238,7 +238,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -249,7 +249,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- ../scripts/Hasher.pm ../scripts/StaticString.pm ../scripts/make_names.pl ../xml/xmlattrs.in -- --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -260,7 +260,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_gyp_core_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -I../scripts ../css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_RESOLUTION_MEDIA_QUERY=0\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_BUILTIN_UTF8_CODEC=1\" \"WTF_USE_WEBKIT_IMAGE_DECODERS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" ../css/CSSGrammar.y.in ../css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core/core.gyp; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -I../scripts ../css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_3D_PLUGIN=1\" \"ENABLE_BATTERY_STATUS=0\" \"ENABLE_CANVAS_USES_MAILBOX=0\" \"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_DEVICE_ADAPTATION=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA=1\" \"ENABLE_SVG=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_WEBGL=1\" \"ENABLE_XHR_TIMEOUT=0\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_DATALIST_ELEMENT=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_INPUT_TYPE_COLOR=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PAGE_POPUP=0\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_BINDING_INTEGRITY=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" ../css/CSSGrammar.y.in ../css/CSSGrammar.y.includes
 
 
 
diff --git a/Source/core/core.gyp/webcore_derived.target.darwin-arm.mk b/Source/core/core.gyp/webcore_derived.target.darwin-arm.mk
index 974c007..515e5b0 100644
--- a/Source/core/core.gyp/webcore_derived.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_derived.target.darwin-arm.mk
@@ -258,7 +258,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomXPathNSResolver.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DOMFormDataCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMPointCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMStringMapCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMWindowCustom.cpp \
@@ -274,6 +273,7 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventTargetCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8FileReaderCustom.cpp \
+	third_party/WebKit/Source/bindings/v8/custom/V8FormDataCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8GeolocationCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp \
@@ -391,14 +391,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -424,7 +421,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_derived.target.darwin-x86.mk b/Source/core/core.gyp/webcore_derived.target.darwin-x86.mk
index f662c0f..da0649c 100644
--- a/Source/core/core.gyp/webcore_derived.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_derived.target.darwin-x86.mk
@@ -258,7 +258,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomXPathNSResolver.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DOMFormDataCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMPointCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMStringMapCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMWindowCustom.cpp \
@@ -274,6 +273,7 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventTargetCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8FileReaderCustom.cpp \
+	third_party/WebKit/Source/bindings/v8/custom/V8FormDataCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8GeolocationCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp \
@@ -393,14 +393,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -426,7 +423,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_derived.target.linux-arm.mk b/Source/core/core.gyp/webcore_derived.target.linux-arm.mk
index 974c007..515e5b0 100644
--- a/Source/core/core.gyp/webcore_derived.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_derived.target.linux-arm.mk
@@ -258,7 +258,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomXPathNSResolver.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DOMFormDataCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMPointCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMStringMapCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMWindowCustom.cpp \
@@ -274,6 +273,7 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventTargetCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8FileReaderCustom.cpp \
+	third_party/WebKit/Source/bindings/v8/custom/V8FormDataCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8GeolocationCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp \
@@ -391,14 +391,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -424,7 +421,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_derived.target.linux-x86.mk b/Source/core/core.gyp/webcore_derived.target.linux-x86.mk
index f662c0f..da0649c 100644
--- a/Source/core/core.gyp/webcore_derived.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_derived.target.linux-x86.mk
@@ -258,7 +258,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomXPathNSResolver.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DOMFormDataCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMPointCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMStringMapCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DOMWindowCustom.cpp \
@@ -274,6 +273,7 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventTargetCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8FileReaderCustom.cpp \
+	third_party/WebKit/Source/bindings/v8/custom/V8FormDataCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8GeolocationCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp \
@@ -393,14 +393,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -426,7 +423,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_dom.target.darwin-arm.mk b/Source/core/core.gyp/webcore_dom.target.darwin-arm.mk
index c994068..78a4791 100644
--- a/Source/core/core.gyp/webcore_dom.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_dom.target.darwin-arm.mk
@@ -40,7 +40,6 @@
 	third_party/WebKit/Source/core/dom/Clipboard.cpp \
 	third_party/WebKit/Source/core/dom/ClipboardEvent.cpp \
 	third_party/WebKit/Source/core/dom/Comment.cpp \
-	third_party/WebKit/Source/core/dom/ComposedShadowTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/CompositionEvent.cpp \
 	third_party/WebKit/Source/core/dom/ContainerNode.cpp \
 	third_party/WebKit/Source/core/dom/ContainerNodeAlgorithms.cpp \
@@ -73,7 +72,6 @@
 	third_party/WebKit/Source/core/dom/DocumentSharedObjectPool.cpp \
 	third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/DocumentType.cpp \
-	third_party/WebKit/Source/core/dom/ElementShadow.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
 	third_party/WebKit/Source/core/dom/ErrorEvent.cpp \
@@ -141,7 +139,6 @@
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
-	third_party/WebKit/Source/core/dom/ShadowRoot.cpp \
 	third_party/WebKit/Source/core/dom/SpaceSplitString.cpp \
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
@@ -169,7 +166,14 @@
 	third_party/WebKit/Source/core/dom/WebCoreMemoryInstrumentation.cpp \
 	third_party/WebKit/Source/core/dom/WheelEvent.cpp \
 	third_party/WebKit/Source/core/dom/WindowEventContext.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
+	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ContentSelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
+	third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp \
+	third_party/WebKit/Source/core/dom/shadow/SelectRuleFeatureSet.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -233,14 +237,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -266,7 +267,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_dom.target.darwin-x86.mk b/Source/core/core.gyp/webcore_dom.target.darwin-x86.mk
index e741cf3..73e113f 100644
--- a/Source/core/core.gyp/webcore_dom.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_dom.target.darwin-x86.mk
@@ -40,7 +40,6 @@
 	third_party/WebKit/Source/core/dom/Clipboard.cpp \
 	third_party/WebKit/Source/core/dom/ClipboardEvent.cpp \
 	third_party/WebKit/Source/core/dom/Comment.cpp \
-	third_party/WebKit/Source/core/dom/ComposedShadowTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/CompositionEvent.cpp \
 	third_party/WebKit/Source/core/dom/ContainerNode.cpp \
 	third_party/WebKit/Source/core/dom/ContainerNodeAlgorithms.cpp \
@@ -73,7 +72,6 @@
 	third_party/WebKit/Source/core/dom/DocumentSharedObjectPool.cpp \
 	third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/DocumentType.cpp \
-	third_party/WebKit/Source/core/dom/ElementShadow.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
 	third_party/WebKit/Source/core/dom/ErrorEvent.cpp \
@@ -141,7 +139,6 @@
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
-	third_party/WebKit/Source/core/dom/ShadowRoot.cpp \
 	third_party/WebKit/Source/core/dom/SpaceSplitString.cpp \
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
@@ -169,7 +166,14 @@
 	third_party/WebKit/Source/core/dom/WebCoreMemoryInstrumentation.cpp \
 	third_party/WebKit/Source/core/dom/WheelEvent.cpp \
 	third_party/WebKit/Source/core/dom/WindowEventContext.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
+	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ContentSelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
+	third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp \
+	third_party/WebKit/Source/core/dom/shadow/SelectRuleFeatureSet.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -235,14 +239,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -268,7 +269,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_dom.target.linux-arm.mk b/Source/core/core.gyp/webcore_dom.target.linux-arm.mk
index c994068..78a4791 100644
--- a/Source/core/core.gyp/webcore_dom.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_dom.target.linux-arm.mk
@@ -40,7 +40,6 @@
 	third_party/WebKit/Source/core/dom/Clipboard.cpp \
 	third_party/WebKit/Source/core/dom/ClipboardEvent.cpp \
 	third_party/WebKit/Source/core/dom/Comment.cpp \
-	third_party/WebKit/Source/core/dom/ComposedShadowTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/CompositionEvent.cpp \
 	third_party/WebKit/Source/core/dom/ContainerNode.cpp \
 	third_party/WebKit/Source/core/dom/ContainerNodeAlgorithms.cpp \
@@ -73,7 +72,6 @@
 	third_party/WebKit/Source/core/dom/DocumentSharedObjectPool.cpp \
 	third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/DocumentType.cpp \
-	third_party/WebKit/Source/core/dom/ElementShadow.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
 	third_party/WebKit/Source/core/dom/ErrorEvent.cpp \
@@ -141,7 +139,6 @@
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
-	third_party/WebKit/Source/core/dom/ShadowRoot.cpp \
 	third_party/WebKit/Source/core/dom/SpaceSplitString.cpp \
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
@@ -169,7 +166,14 @@
 	third_party/WebKit/Source/core/dom/WebCoreMemoryInstrumentation.cpp \
 	third_party/WebKit/Source/core/dom/WheelEvent.cpp \
 	third_party/WebKit/Source/core/dom/WindowEventContext.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
+	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ContentSelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
+	third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp \
+	third_party/WebKit/Source/core/dom/shadow/SelectRuleFeatureSet.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -233,14 +237,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -266,7 +267,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_dom.target.linux-x86.mk b/Source/core/core.gyp/webcore_dom.target.linux-x86.mk
index e741cf3..73e113f 100644
--- a/Source/core/core.gyp/webcore_dom.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_dom.target.linux-x86.mk
@@ -40,7 +40,6 @@
 	third_party/WebKit/Source/core/dom/Clipboard.cpp \
 	third_party/WebKit/Source/core/dom/ClipboardEvent.cpp \
 	third_party/WebKit/Source/core/dom/Comment.cpp \
-	third_party/WebKit/Source/core/dom/ComposedShadowTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/CompositionEvent.cpp \
 	third_party/WebKit/Source/core/dom/ContainerNode.cpp \
 	third_party/WebKit/Source/core/dom/ContainerNodeAlgorithms.cpp \
@@ -73,7 +72,6 @@
 	third_party/WebKit/Source/core/dom/DocumentSharedObjectPool.cpp \
 	third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/DocumentType.cpp \
-	third_party/WebKit/Source/core/dom/ElementShadow.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
 	third_party/WebKit/Source/core/dom/ErrorEvent.cpp \
@@ -141,7 +139,6 @@
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
-	third_party/WebKit/Source/core/dom/ShadowRoot.cpp \
 	third_party/WebKit/Source/core/dom/SpaceSplitString.cpp \
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
@@ -169,7 +166,14 @@
 	third_party/WebKit/Source/core/dom/WebCoreMemoryInstrumentation.cpp \
 	third_party/WebKit/Source/core/dom/WheelEvent.cpp \
 	third_party/WebKit/Source/core/dom/WindowEventContext.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
+	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ContentSelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
+	third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp \
+	third_party/WebKit/Source/core/dom/shadow/SelectRuleFeatureSet.cpp \
+	third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -235,14 +239,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -268,7 +269,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_html.target.darwin-arm.mk b/Source/core/core.gyp/webcore_html.target.darwin-arm.mk
index 248c6cf..d077fa5 100644
--- a/Source/core/core.gyp/webcore_html.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_html.target.darwin-arm.mk
@@ -41,7 +41,6 @@
 	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/DateInputType.cpp \
 	third_party/WebKit/Source/core/html/DateTimeFieldsState.cpp \
-	third_party/WebKit/Source/core/html/DateTimeInputType.cpp \
 	third_party/WebKit/Source/core/html/DateTimeLocalInputType.cpp \
 	third_party/WebKit/Source/core/html/EmailInputType.cpp \
 	third_party/WebKit/Source/core/html/FileInputType.cpp \
@@ -241,8 +240,6 @@
 	third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.cpp \
 	third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/ContentDistributor.cpp \
-	third_party/WebKit/Source/core/html/shadow/ContentSelectorQuery.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeEditElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeFieldElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp \
@@ -251,7 +248,6 @@
 	third_party/WebKit/Source/core/html/shadow/DetailsMarkerControl.cpp \
 	third_party/WebKit/Source/core/html/shadow/HTMLContentElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/HTMLShadowElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/InsertionPoint.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControls.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp \
@@ -259,7 +255,6 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/SelectRuleFeatureSet.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
@@ -343,14 +338,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -376,7 +368,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_html.target.darwin-x86.mk b/Source/core/core.gyp/webcore_html.target.darwin-x86.mk
index e1f4abf..456888e 100644
--- a/Source/core/core.gyp/webcore_html.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_html.target.darwin-x86.mk
@@ -41,7 +41,6 @@
 	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/DateInputType.cpp \
 	third_party/WebKit/Source/core/html/DateTimeFieldsState.cpp \
-	third_party/WebKit/Source/core/html/DateTimeInputType.cpp \
 	third_party/WebKit/Source/core/html/DateTimeLocalInputType.cpp \
 	third_party/WebKit/Source/core/html/EmailInputType.cpp \
 	third_party/WebKit/Source/core/html/FileInputType.cpp \
@@ -241,8 +240,6 @@
 	third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.cpp \
 	third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/ContentDistributor.cpp \
-	third_party/WebKit/Source/core/html/shadow/ContentSelectorQuery.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeEditElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeFieldElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp \
@@ -251,7 +248,6 @@
 	third_party/WebKit/Source/core/html/shadow/DetailsMarkerControl.cpp \
 	third_party/WebKit/Source/core/html/shadow/HTMLContentElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/HTMLShadowElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/InsertionPoint.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControls.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp \
@@ -259,7 +255,6 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/SelectRuleFeatureSet.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
@@ -345,14 +340,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -378,7 +370,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_html.target.linux-arm.mk b/Source/core/core.gyp/webcore_html.target.linux-arm.mk
index 248c6cf..d077fa5 100644
--- a/Source/core/core.gyp/webcore_html.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_html.target.linux-arm.mk
@@ -41,7 +41,6 @@
 	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/DateInputType.cpp \
 	third_party/WebKit/Source/core/html/DateTimeFieldsState.cpp \
-	third_party/WebKit/Source/core/html/DateTimeInputType.cpp \
 	third_party/WebKit/Source/core/html/DateTimeLocalInputType.cpp \
 	third_party/WebKit/Source/core/html/EmailInputType.cpp \
 	third_party/WebKit/Source/core/html/FileInputType.cpp \
@@ -241,8 +240,6 @@
 	third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.cpp \
 	third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/ContentDistributor.cpp \
-	third_party/WebKit/Source/core/html/shadow/ContentSelectorQuery.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeEditElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeFieldElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp \
@@ -251,7 +248,6 @@
 	third_party/WebKit/Source/core/html/shadow/DetailsMarkerControl.cpp \
 	third_party/WebKit/Source/core/html/shadow/HTMLContentElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/HTMLShadowElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/InsertionPoint.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControls.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp \
@@ -259,7 +255,6 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/SelectRuleFeatureSet.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
@@ -343,14 +338,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -376,7 +368,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_html.target.linux-x86.mk b/Source/core/core.gyp/webcore_html.target.linux-x86.mk
index e1f4abf..456888e 100644
--- a/Source/core/core.gyp/webcore_html.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_html.target.linux-x86.mk
@@ -41,7 +41,6 @@
 	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/DateInputType.cpp \
 	third_party/WebKit/Source/core/html/DateTimeFieldsState.cpp \
-	third_party/WebKit/Source/core/html/DateTimeInputType.cpp \
 	third_party/WebKit/Source/core/html/DateTimeLocalInputType.cpp \
 	third_party/WebKit/Source/core/html/EmailInputType.cpp \
 	third_party/WebKit/Source/core/html/FileInputType.cpp \
@@ -241,8 +240,6 @@
 	third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.cpp \
 	third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/ContentDistributor.cpp \
-	third_party/WebKit/Source/core/html/shadow/ContentSelectorQuery.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeEditElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeFieldElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp \
@@ -251,7 +248,6 @@
 	third_party/WebKit/Source/core/html/shadow/DetailsMarkerControl.cpp \
 	third_party/WebKit/Source/core/html/shadow/HTMLContentElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/HTMLShadowElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/InsertionPoint.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControls.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp \
@@ -259,7 +255,6 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
-	third_party/WebKit/Source/core/html/shadow/SelectRuleFeatureSet.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
@@ -345,14 +340,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -378,7 +370,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_platform.target.darwin-arm.mk b/Source/core/core.gyp/webcore_platform.target.darwin-arm.mk
index ac2a491..ef254e9 100644
--- a/Source/core/core.gyp/webcore_platform.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_platform.target.darwin-arm.mk
@@ -38,7 +38,6 @@
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
 	third_party/WebKit/Source/core/platform/FileChooser.cpp \
 	third_party/WebKit/Source/core/platform/FileIconLoader.cpp \
-	third_party/WebKit/Source/core/platform/FileStream.cpp \
 	third_party/WebKit/Source/core/platform/KillRingNone.cpp \
 	third_party/WebKit/Source/core/platform/Language.cpp \
 	third_party/WebKit/Source/core/platform/LayoutTestSupport.cpp \
@@ -107,7 +106,6 @@
 	third_party/WebKit/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp \
 	third_party/WebKit/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp \
 	third_party/WebKit/Source/core/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp \
-	third_party/WebKit/Source/core/platform/audio/mkl/FFTFrameMKL.cpp \
 	third_party/WebKit/Source/core/platform/audio/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
@@ -340,6 +338,7 @@
 	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp \
 	third_party/WebKit/Source/core/platform/text/BidiContext.cpp \
 	third_party/WebKit/Source/core/platform/text/DateTimeFormat.cpp \
+	third_party/WebKit/Source/core/platform/text/Hyphenation.cpp \
 	third_party/WebKit/Source/core/platform/text/LineEnding.cpp \
 	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
 	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
@@ -350,11 +349,10 @@
 	third_party/WebKit/Source/core/platform/text/TextBoundaries.cpp \
 	third_party/WebKit/Source/core/platform/text/TextBreakIterator.cpp \
 	third_party/WebKit/Source/core/platform/text/TextBreakIteratorICU.cpp \
+	third_party/WebKit/Source/core/platform/text/TextBreakIteratorInternalICU.cpp \
 	third_party/WebKit/Source/core/platform/text/TextEncodingDetectorICU.cpp \
 	third_party/WebKit/Source/core/platform/text/TextStream.cpp \
 	third_party/WebKit/Source/core/platform/text/UnicodeRange.cpp \
-	third_party/WebKit/Source/core/platform/text/chromium/Hyphenation.cpp \
-	third_party/WebKit/Source/core/platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp \
 	third_party/WebKit/Source/core/platform/text/transcoder/FontTranscoder.cpp
 
 
@@ -419,14 +417,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -452,7 +447,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_platform.target.darwin-x86.mk b/Source/core/core.gyp/webcore_platform.target.darwin-x86.mk
index 76d1d75..95a1d09 100644
--- a/Source/core/core.gyp/webcore_platform.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_platform.target.darwin-x86.mk
@@ -38,7 +38,6 @@
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
 	third_party/WebKit/Source/core/platform/FileChooser.cpp \
 	third_party/WebKit/Source/core/platform/FileIconLoader.cpp \
-	third_party/WebKit/Source/core/platform/FileStream.cpp \
 	third_party/WebKit/Source/core/platform/KillRingNone.cpp \
 	third_party/WebKit/Source/core/platform/Language.cpp \
 	third_party/WebKit/Source/core/platform/LayoutTestSupport.cpp \
@@ -107,7 +106,6 @@
 	third_party/WebKit/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp \
 	third_party/WebKit/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp \
 	third_party/WebKit/Source/core/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp \
-	third_party/WebKit/Source/core/platform/audio/mkl/FFTFrameMKL.cpp \
 	third_party/WebKit/Source/core/platform/audio/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
@@ -340,6 +338,7 @@
 	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp \
 	third_party/WebKit/Source/core/platform/text/BidiContext.cpp \
 	third_party/WebKit/Source/core/platform/text/DateTimeFormat.cpp \
+	third_party/WebKit/Source/core/platform/text/Hyphenation.cpp \
 	third_party/WebKit/Source/core/platform/text/LineEnding.cpp \
 	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
 	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
@@ -350,11 +349,10 @@
 	third_party/WebKit/Source/core/platform/text/TextBoundaries.cpp \
 	third_party/WebKit/Source/core/platform/text/TextBreakIterator.cpp \
 	third_party/WebKit/Source/core/platform/text/TextBreakIteratorICU.cpp \
+	third_party/WebKit/Source/core/platform/text/TextBreakIteratorInternalICU.cpp \
 	third_party/WebKit/Source/core/platform/text/TextEncodingDetectorICU.cpp \
 	third_party/WebKit/Source/core/platform/text/TextStream.cpp \
 	third_party/WebKit/Source/core/platform/text/UnicodeRange.cpp \
-	third_party/WebKit/Source/core/platform/text/chromium/Hyphenation.cpp \
-	third_party/WebKit/Source/core/platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp \
 	third_party/WebKit/Source/core/platform/text/transcoder/FontTranscoder.cpp
 
 
@@ -421,14 +419,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -454,7 +449,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_platform.target.linux-arm.mk b/Source/core/core.gyp/webcore_platform.target.linux-arm.mk
index ac2a491..ef254e9 100644
--- a/Source/core/core.gyp/webcore_platform.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_platform.target.linux-arm.mk
@@ -38,7 +38,6 @@
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
 	third_party/WebKit/Source/core/platform/FileChooser.cpp \
 	third_party/WebKit/Source/core/platform/FileIconLoader.cpp \
-	third_party/WebKit/Source/core/platform/FileStream.cpp \
 	third_party/WebKit/Source/core/platform/KillRingNone.cpp \
 	third_party/WebKit/Source/core/platform/Language.cpp \
 	third_party/WebKit/Source/core/platform/LayoutTestSupport.cpp \
@@ -107,7 +106,6 @@
 	third_party/WebKit/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp \
 	third_party/WebKit/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp \
 	third_party/WebKit/Source/core/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp \
-	third_party/WebKit/Source/core/platform/audio/mkl/FFTFrameMKL.cpp \
 	third_party/WebKit/Source/core/platform/audio/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
@@ -340,6 +338,7 @@
 	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp \
 	third_party/WebKit/Source/core/platform/text/BidiContext.cpp \
 	third_party/WebKit/Source/core/platform/text/DateTimeFormat.cpp \
+	third_party/WebKit/Source/core/platform/text/Hyphenation.cpp \
 	third_party/WebKit/Source/core/platform/text/LineEnding.cpp \
 	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
 	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
@@ -350,11 +349,10 @@
 	third_party/WebKit/Source/core/platform/text/TextBoundaries.cpp \
 	third_party/WebKit/Source/core/platform/text/TextBreakIterator.cpp \
 	third_party/WebKit/Source/core/platform/text/TextBreakIteratorICU.cpp \
+	third_party/WebKit/Source/core/platform/text/TextBreakIteratorInternalICU.cpp \
 	third_party/WebKit/Source/core/platform/text/TextEncodingDetectorICU.cpp \
 	third_party/WebKit/Source/core/platform/text/TextStream.cpp \
 	third_party/WebKit/Source/core/platform/text/UnicodeRange.cpp \
-	third_party/WebKit/Source/core/platform/text/chromium/Hyphenation.cpp \
-	third_party/WebKit/Source/core/platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp \
 	third_party/WebKit/Source/core/platform/text/transcoder/FontTranscoder.cpp
 
 
@@ -419,14 +417,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -452,7 +447,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_platform.target.linux-x86.mk b/Source/core/core.gyp/webcore_platform.target.linux-x86.mk
index 76d1d75..95a1d09 100644
--- a/Source/core/core.gyp/webcore_platform.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_platform.target.linux-x86.mk
@@ -38,7 +38,6 @@
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
 	third_party/WebKit/Source/core/platform/FileChooser.cpp \
 	third_party/WebKit/Source/core/platform/FileIconLoader.cpp \
-	third_party/WebKit/Source/core/platform/FileStream.cpp \
 	third_party/WebKit/Source/core/platform/KillRingNone.cpp \
 	third_party/WebKit/Source/core/platform/Language.cpp \
 	third_party/WebKit/Source/core/platform/LayoutTestSupport.cpp \
@@ -107,7 +106,6 @@
 	third_party/WebKit/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp \
 	third_party/WebKit/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp \
 	third_party/WebKit/Source/core/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp \
-	third_party/WebKit/Source/core/platform/audio/mkl/FFTFrameMKL.cpp \
 	third_party/WebKit/Source/core/platform/audio/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
@@ -340,6 +338,7 @@
 	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp \
 	third_party/WebKit/Source/core/platform/text/BidiContext.cpp \
 	third_party/WebKit/Source/core/platform/text/DateTimeFormat.cpp \
+	third_party/WebKit/Source/core/platform/text/Hyphenation.cpp \
 	third_party/WebKit/Source/core/platform/text/LineEnding.cpp \
 	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
 	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
@@ -350,11 +349,10 @@
 	third_party/WebKit/Source/core/platform/text/TextBoundaries.cpp \
 	third_party/WebKit/Source/core/platform/text/TextBreakIterator.cpp \
 	third_party/WebKit/Source/core/platform/text/TextBreakIteratorICU.cpp \
+	third_party/WebKit/Source/core/platform/text/TextBreakIteratorInternalICU.cpp \
 	third_party/WebKit/Source/core/platform/text/TextEncodingDetectorICU.cpp \
 	third_party/WebKit/Source/core/platform/text/TextStream.cpp \
 	third_party/WebKit/Source/core/platform/text/UnicodeRange.cpp \
-	third_party/WebKit/Source/core/platform/text/chromium/Hyphenation.cpp \
-	third_party/WebKit/Source/core/platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp \
 	third_party/WebKit/Source/core/platform/text/transcoder/FontTranscoder.cpp
 
 
@@ -421,14 +419,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -454,7 +449,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_platform_geometry.target.darwin-arm.mk b/Source/core/core.gyp/webcore_platform_geometry.target.darwin-arm.mk
index 428a091..ef85524 100644
--- a/Source/core/core.gyp/webcore_platform_geometry.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_platform_geometry.target.darwin-arm.mk
@@ -98,14 +98,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -131,7 +128,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_platform_geometry.target.darwin-x86.mk b/Source/core/core.gyp/webcore_platform_geometry.target.darwin-x86.mk
index a3b73a3..f6e5cee 100644
--- a/Source/core/core.gyp/webcore_platform_geometry.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_platform_geometry.target.darwin-x86.mk
@@ -100,14 +100,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -133,7 +130,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_platform_geometry.target.linux-arm.mk b/Source/core/core.gyp/webcore_platform_geometry.target.linux-arm.mk
index 428a091..ef85524 100644
--- a/Source/core/core.gyp/webcore_platform_geometry.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_platform_geometry.target.linux-arm.mk
@@ -98,14 +98,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -131,7 +128,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_platform_geometry.target.linux-x86.mk b/Source/core/core.gyp/webcore_platform_geometry.target.linux-x86.mk
index a3b73a3..f6e5cee 100644
--- a/Source/core/core.gyp/webcore_platform_geometry.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_platform_geometry.target.linux-x86.mk
@@ -100,14 +100,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -133,7 +130,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_prerequisites.target.darwin-arm.mk b/Source/core/core.gyp/webcore_prerequisites.target.darwin-arm.mk
index 943721a..f70fe39 100644
--- a/Source/core/core.gyp/webcore_prerequisites.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_prerequisites.target.darwin-arm.mk
@@ -22,7 +22,7 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_Platform_Platform_gyp_webkit_platform_gyp)/webkit_platform.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_wtf_wtf_gyp)/third_party_WebKit_Source_wtf_wtf_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
-	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_origin_origin_gyp)/third_party_WebKit_Source_origin_origin_gyp.a \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_weborigin_weborigin_gyp)/third_party_WebKit_Source_weborigin_weborigin_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,build_temp_gyp_googleurl_gyp)/build_temp_gyp_googleurl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a \
diff --git a/Source/core/core.gyp/webcore_prerequisites.target.darwin-x86.mk b/Source/core/core.gyp/webcore_prerequisites.target.darwin-x86.mk
index 943721a..f70fe39 100644
--- a/Source/core/core.gyp/webcore_prerequisites.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_prerequisites.target.darwin-x86.mk
@@ -22,7 +22,7 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_Platform_Platform_gyp_webkit_platform_gyp)/webkit_platform.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_wtf_wtf_gyp)/third_party_WebKit_Source_wtf_wtf_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
-	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_origin_origin_gyp)/third_party_WebKit_Source_origin_origin_gyp.a \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_weborigin_weborigin_gyp)/third_party_WebKit_Source_weborigin_weborigin_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,build_temp_gyp_googleurl_gyp)/build_temp_gyp_googleurl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a \
diff --git a/Source/core/core.gyp/webcore_prerequisites.target.linux-arm.mk b/Source/core/core.gyp/webcore_prerequisites.target.linux-arm.mk
index 943721a..f70fe39 100644
--- a/Source/core/core.gyp/webcore_prerequisites.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_prerequisites.target.linux-arm.mk
@@ -22,7 +22,7 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_Platform_Platform_gyp_webkit_platform_gyp)/webkit_platform.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_wtf_wtf_gyp)/third_party_WebKit_Source_wtf_wtf_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
-	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_origin_origin_gyp)/third_party_WebKit_Source_origin_origin_gyp.a \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_weborigin_weborigin_gyp)/third_party_WebKit_Source_weborigin_weborigin_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,build_temp_gyp_googleurl_gyp)/build_temp_gyp_googleurl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a \
diff --git a/Source/core/core.gyp/webcore_prerequisites.target.linux-x86.mk b/Source/core/core.gyp/webcore_prerequisites.target.linux-x86.mk
index 943721a..f70fe39 100644
--- a/Source/core/core.gyp/webcore_prerequisites.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_prerequisites.target.linux-x86.mk
@@ -22,7 +22,7 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_Platform_Platform_gyp_webkit_platform_gyp)/webkit_platform.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_wtf_wtf_gyp)/third_party_WebKit_Source_wtf_wtf_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
-	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_origin_origin_gyp)/third_party_WebKit_Source_origin_origin_gyp.a \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_weborigin_weborigin_gyp)/third_party_WebKit_Source_weborigin_weborigin_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,build_temp_gyp_googleurl_gyp)/build_temp_gyp_googleurl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_gyp)/skia_skia_gyp.a \
diff --git a/Source/core/core.gyp/webcore_remaining.target.darwin-arm.mk b/Source/core/core.gyp/webcore_remaining.target.darwin-arm.mk
index 7e0389a..ac85210 100644
--- a/Source/core/core.gyp/webcore_remaining.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_remaining.target.darwin-arm.mk
@@ -172,7 +172,6 @@
 	third_party/WebKit/Source/core/editing/CreateLinkCommand.cpp \
 	third_party/WebKit/Source/core/editing/DeleteFromTextNodeCommand.cpp \
 	third_party/WebKit/Source/core/editing/DeleteSelectionCommand.cpp \
-	third_party/WebKit/Source/core/editing/DictationAlternative.cpp \
 	third_party/WebKit/Source/core/editing/EditCommand.cpp \
 	third_party/WebKit/Source/core/editing/EditingStyle.cpp \
 	third_party/WebKit/Source/core/editing/Editor.cpp \
@@ -230,7 +229,6 @@
 	third_party/WebKit/Source/core/fileapi/FileReader.cpp \
 	third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp \
 	third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp \
-	third_party/WebKit/Source/core/fileapi/FileThread.cpp \
 	third_party/WebKit/Source/core/fileapi/ThreadableBlobRegistry.cpp \
 	third_party/WebKit/Source/core/history/BackForwardController.cpp \
 	third_party/WebKit/Source/core/history/HistoryItem.cpp \
@@ -355,7 +353,7 @@
 	third_party/WebKit/Source/core/loader/cache/CachedXSLStyleSheet.cpp \
 	third_party/WebKit/Source/core/loader/cache/MemoryCache.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarInfo.cpp \
+	third_party/WebKit/Source/core/page/BarProp.cpp \
 	third_party/WebKit/Source/core/page/CaptionUserPreferences.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
 	third_party/WebKit/Source/core/page/Console.cpp \
@@ -546,14 +544,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -579,7 +574,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_remaining.target.darwin-x86.mk b/Source/core/core.gyp/webcore_remaining.target.darwin-x86.mk
index 7865946..1de6ee3 100644
--- a/Source/core/core.gyp/webcore_remaining.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_remaining.target.darwin-x86.mk
@@ -172,7 +172,6 @@
 	third_party/WebKit/Source/core/editing/CreateLinkCommand.cpp \
 	third_party/WebKit/Source/core/editing/DeleteFromTextNodeCommand.cpp \
 	third_party/WebKit/Source/core/editing/DeleteSelectionCommand.cpp \
-	third_party/WebKit/Source/core/editing/DictationAlternative.cpp \
 	third_party/WebKit/Source/core/editing/EditCommand.cpp \
 	third_party/WebKit/Source/core/editing/EditingStyle.cpp \
 	third_party/WebKit/Source/core/editing/Editor.cpp \
@@ -230,7 +229,6 @@
 	third_party/WebKit/Source/core/fileapi/FileReader.cpp \
 	third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp \
 	third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp \
-	third_party/WebKit/Source/core/fileapi/FileThread.cpp \
 	third_party/WebKit/Source/core/fileapi/ThreadableBlobRegistry.cpp \
 	third_party/WebKit/Source/core/history/BackForwardController.cpp \
 	third_party/WebKit/Source/core/history/HistoryItem.cpp \
@@ -355,7 +353,7 @@
 	third_party/WebKit/Source/core/loader/cache/CachedXSLStyleSheet.cpp \
 	third_party/WebKit/Source/core/loader/cache/MemoryCache.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarInfo.cpp \
+	third_party/WebKit/Source/core/page/BarProp.cpp \
 	third_party/WebKit/Source/core/page/CaptionUserPreferences.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
 	third_party/WebKit/Source/core/page/Console.cpp \
@@ -548,14 +546,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -581,7 +576,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_remaining.target.linux-arm.mk b/Source/core/core.gyp/webcore_remaining.target.linux-arm.mk
index 7e0389a..ac85210 100644
--- a/Source/core/core.gyp/webcore_remaining.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_remaining.target.linux-arm.mk
@@ -172,7 +172,6 @@
 	third_party/WebKit/Source/core/editing/CreateLinkCommand.cpp \
 	third_party/WebKit/Source/core/editing/DeleteFromTextNodeCommand.cpp \
 	third_party/WebKit/Source/core/editing/DeleteSelectionCommand.cpp \
-	third_party/WebKit/Source/core/editing/DictationAlternative.cpp \
 	third_party/WebKit/Source/core/editing/EditCommand.cpp \
 	third_party/WebKit/Source/core/editing/EditingStyle.cpp \
 	third_party/WebKit/Source/core/editing/Editor.cpp \
@@ -230,7 +229,6 @@
 	third_party/WebKit/Source/core/fileapi/FileReader.cpp \
 	third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp \
 	third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp \
-	third_party/WebKit/Source/core/fileapi/FileThread.cpp \
 	third_party/WebKit/Source/core/fileapi/ThreadableBlobRegistry.cpp \
 	third_party/WebKit/Source/core/history/BackForwardController.cpp \
 	third_party/WebKit/Source/core/history/HistoryItem.cpp \
@@ -355,7 +353,7 @@
 	third_party/WebKit/Source/core/loader/cache/CachedXSLStyleSheet.cpp \
 	third_party/WebKit/Source/core/loader/cache/MemoryCache.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarInfo.cpp \
+	third_party/WebKit/Source/core/page/BarProp.cpp \
 	third_party/WebKit/Source/core/page/CaptionUserPreferences.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
 	third_party/WebKit/Source/core/page/Console.cpp \
@@ -546,14 +544,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -579,7 +574,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_remaining.target.linux-x86.mk b/Source/core/core.gyp/webcore_remaining.target.linux-x86.mk
index 7865946..1de6ee3 100644
--- a/Source/core/core.gyp/webcore_remaining.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_remaining.target.linux-x86.mk
@@ -172,7 +172,6 @@
 	third_party/WebKit/Source/core/editing/CreateLinkCommand.cpp \
 	third_party/WebKit/Source/core/editing/DeleteFromTextNodeCommand.cpp \
 	third_party/WebKit/Source/core/editing/DeleteSelectionCommand.cpp \
-	third_party/WebKit/Source/core/editing/DictationAlternative.cpp \
 	third_party/WebKit/Source/core/editing/EditCommand.cpp \
 	third_party/WebKit/Source/core/editing/EditingStyle.cpp \
 	third_party/WebKit/Source/core/editing/Editor.cpp \
@@ -230,7 +229,6 @@
 	third_party/WebKit/Source/core/fileapi/FileReader.cpp \
 	third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp \
 	third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp \
-	third_party/WebKit/Source/core/fileapi/FileThread.cpp \
 	third_party/WebKit/Source/core/fileapi/ThreadableBlobRegistry.cpp \
 	third_party/WebKit/Source/core/history/BackForwardController.cpp \
 	third_party/WebKit/Source/core/history/HistoryItem.cpp \
@@ -355,7 +353,7 @@
 	third_party/WebKit/Source/core/loader/cache/CachedXSLStyleSheet.cpp \
 	third_party/WebKit/Source/core/loader/cache/MemoryCache.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarInfo.cpp \
+	third_party/WebKit/Source/core/page/BarProp.cpp \
 	third_party/WebKit/Source/core/page/CaptionUserPreferences.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
 	third_party/WebKit/Source/core/page/Console.cpp \
@@ -548,14 +546,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -581,7 +576,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_rendering.target.darwin-arm.mk b/Source/core/core.gyp/webcore_rendering.target.darwin-arm.mk
index 73fc45e..ba85ae2 100644
--- a/Source/core/core.gyp/webcore_rendering.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_rendering.target.darwin-arm.mk
@@ -238,14 +238,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -271,7 +268,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_rendering.target.darwin-x86.mk b/Source/core/core.gyp/webcore_rendering.target.darwin-x86.mk
index 6f6b356..1547bee 100644
--- a/Source/core/core.gyp/webcore_rendering.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_rendering.target.darwin-x86.mk
@@ -241,14 +241,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -274,7 +271,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_rendering.target.linux-arm.mk b/Source/core/core.gyp/webcore_rendering.target.linux-arm.mk
index 73fc45e..ba85ae2 100644
--- a/Source/core/core.gyp/webcore_rendering.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_rendering.target.linux-arm.mk
@@ -238,14 +238,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -271,7 +268,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_rendering.target.linux-x86.mk b/Source/core/core.gyp/webcore_rendering.target.linux-x86.mk
index 6f6b356..1547bee 100644
--- a/Source/core/core.gyp/webcore_rendering.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_rendering.target.linux-x86.mk
@@ -241,14 +241,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -274,7 +271,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_svg.target.darwin-arm.mk b/Source/core/core.gyp/webcore_svg.target.darwin-arm.mk
index 7aac75f..2698300 100644
--- a/Source/core/core.gyp/webcore_svg.target.darwin-arm.mk
+++ b/Source/core/core.gyp/webcore_svg.target.darwin-arm.mk
@@ -306,14 +306,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -339,7 +336,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_svg.target.darwin-x86.mk b/Source/core/core.gyp/webcore_svg.target.darwin-x86.mk
index c7162f1..e747e44 100644
--- a/Source/core/core.gyp/webcore_svg.target.darwin-x86.mk
+++ b/Source/core/core.gyp/webcore_svg.target.darwin-x86.mk
@@ -308,14 +308,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -341,7 +338,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_svg.target.linux-arm.mk b/Source/core/core.gyp/webcore_svg.target.linux-arm.mk
index 7aac75f..2698300 100644
--- a/Source/core/core.gyp/webcore_svg.target.linux-arm.mk
+++ b/Source/core/core.gyp/webcore_svg.target.linux-arm.mk
@@ -306,14 +306,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -339,7 +336,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gyp/webcore_svg.target.linux-x86.mk b/Source/core/core.gyp/webcore_svg.target.linux-x86.mk
index c7162f1..e747e44 100644
--- a/Source/core/core.gyp/webcore_svg.target.linux-x86.mk
+++ b/Source/core/core.gyp/webcore_svg.target.linux-x86.mk
@@ -308,14 +308,11 @@
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA=1' \
-	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
 	'-DENABLE_SVG=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
 	'-DENABLE_WEBGL=1' \
 	'-DENABLE_XHR_TIMEOUT=0' \
-	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
-	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_DATALIST_ELEMENT=0' \
@@ -341,7 +338,7 @@
 	'-DGR_AGGRESSIVE_SHADER_OPTS=1' \
 	'-DSK_ENABLE_INST_COUNT=0' \
 	'-DSK_USE_POSIX_THREADS' \
-	'-DSK_BUILD_FOR_ANDROID_NDK' \
+	'-DSK_BUILD_FOR_ANDROID' \
 	'-DCHROME_PNG_WRITE_SUPPORT' \
 	'-DPNG_USER_CONFIG' \
 	'-DLIBXML_STATIC' \
diff --git a/Source/core/core.gypi b/Source/core/core.gypi
index 9915d67..0118d21 100644
--- a/Source/core/core.gypi
+++ b/Source/core/core.gypi
@@ -2,6 +2,7 @@
 {
     'variables': {
         'core_idl_files': [
+            'css/CSS.idl',
             'css/CSSCharsetRule.idl',
             'css/CSSFontFaceLoadEvent.idl',
             'css/CSSFontFaceRule.idl',
@@ -22,7 +23,6 @@
             'css/CSSValue.idl',
             'css/CSSValueList.idl',
             'css/Counter.idl',
-            'css/DOMWindowCSS.idl',
             'css/FontLoader.idl',
             'css/MediaList.idl',
             'css/MediaQueryList.idl',
@@ -96,7 +96,6 @@
             'dom/Range.idl',
             'dom/RequestAnimationFrameCallback.idl',
             'dom/SecurityPolicyViolationEvent.idl',
-            'dom/ShadowRoot.idl',
             'dom/StringCallback.idl',
             'dom/Text.idl',
             'dom/TextEvent.idl',
@@ -107,6 +106,7 @@
             'dom/TreeWalker.idl',
             'dom/UIEvent.idl',
             'dom/WheelEvent.idl',
+            'dom/shadow/ShadowRoot.idl',
             'fileapi/Blob.idl',
             'fileapi/File.idl',
             'fileapi/FileError.idl',
@@ -114,10 +114,9 @@
             'fileapi/FileList.idl',
             'fileapi/FileReader.idl',
             'fileapi/FileReaderSync.idl',
-            'html/DOMFormData.idl',
             'html/DOMSettableTokenList.idl',
             'html/DOMTokenList.idl',
-            'html/DOMURL.idl',
+            'html/FormData.idl',
             'html/HTMLAllCollection.idl',
             'html/HTMLAnchorElement.idl',
             'html/HTMLAppletElement.idl',
@@ -200,6 +199,7 @@
             'html/RadioNodeList.idl',
             'html/TextMetrics.idl',
             'html/TimeRanges.idl',
+            'html/URL.idl',
             'html/ValidityState.idl',
             'html/VoidCallback.idl',
             'html/canvas/ArrayBuffer.idl',
@@ -210,7 +210,6 @@
             'html/canvas/CanvasRenderingContext2D.idl',
             'html/canvas/Canvas2DContextAttributes.idl',
             'html/canvas/DataView.idl',
-            'html/canvas/DOMPath.idl',
             'html/canvas/EXTDrawBuffers.idl',
             'html/canvas/EXTTextureFilterAnisotropic.idl',
             'html/canvas/Float32Array.idl',
@@ -223,6 +222,7 @@
             'html/canvas/OESTextureHalfFloat.idl',
             'html/canvas/OESVertexArrayObject.idl',
             'html/canvas/OESElementIndexUint.idl',
+            'html/canvas/Path.idl',
             'html/canvas/Uint16Array.idl',
             'html/canvas/Uint32Array.idl',
             'html/canvas/Uint8Array.idl',
@@ -264,12 +264,10 @@
             'inspector/ScriptProfile.idl',
             'inspector/ScriptProfileNode.idl',
             'loader/appcache/DOMApplicationCache.idl',
-            'page/BarInfo.idl',
+            'page/BarProp.idl',
             'page/Console.idl',
             'page/Crypto.idl',
             'page/DOMPoint.idl',
-            'page/DOMSecurityPolicy.idl',
-            'page/DOMSelection.idl',
             'page/DOMWindow.idl',
             'page/DOMWindowPagePopup.idl',
             'page/EventSource.idl',
@@ -286,6 +284,8 @@
             'page/PerformanceResourceTiming.idl',
             'page/PerformanceTiming.idl',
             'page/Screen.idl',
+            'page/SecurityPolicy.idl',
+            'page/Selection.idl',
             'page/SpeechInputEvent.idl',
             'page/SpeechInputResult.idl',
             'page/SpeechInputResultList.idl',
@@ -737,7 +737,6 @@
             'editing/DeleteFromTextNodeCommand.cpp',
             'editing/DeleteFromTextNodeCommand.h',
             'editing/DeleteSelectionCommand.cpp',
-            'editing/DictationAlternative.cpp',
             'editing/EditCommand.cpp',
             'editing/EditingStyle.cpp',
             'editing/Editor.cpp',
@@ -837,9 +836,6 @@
             'fileapi/FileReaderLoaderClient.h',
             'fileapi/FileReaderSync.cpp',
             'fileapi/FileReaderSync.h',
-            'fileapi/FileThread.cpp',
-            'fileapi/FileThread.h',
-            'fileapi/FileThreadTask.h',
             'fileapi/ThreadableBlobRegistry.cpp',
             'fileapi/ThreadableBlobRegistry.h',
             'history/BackForwardClient.h',
@@ -1104,8 +1100,8 @@
             'loader/cache/MemoryCache.cpp',
             'page/AutoscrollController.cpp',
             'page/AutoscrollController.h',
-            'page/BarInfo.cpp',
-            'page/BarInfo.h',
+            'page/BarProp.cpp',
+            'page/BarProp.h',
             'page/CaptionUserPreferences.cpp',
             'page/Chrome.cpp',
             'page/Console.cpp',
@@ -1681,8 +1677,6 @@
             'dom/ClipboardEvent.h',
             'dom/Comment.cpp',
             'dom/Comment.h',
-            'dom/ComposedShadowTreeWalker.cpp',
-            'dom/ComposedShadowTreeWalker.h',
             'dom/CompositionEvent.cpp',
             'dom/CompositionEvent.h',
             'dom/ContainerNode.cpp',
@@ -1736,7 +1730,6 @@
             'dom/DocumentSharedObjectPool.cpp',
             'dom/DocumentStyleSheetCollection.cpp',
             'dom/DocumentType.cpp',
-            'dom/ElementShadow.cpp',
             'dom/Element.cpp',
             'dom/ElementRareData.cpp',
             'dom/ElementRareData.h',
@@ -1861,8 +1854,6 @@
             'dom/SecurityPolicyViolationEvent.h',
             'dom/SelectorQuery.cpp',
             'dom/SelectorQuery.h',
-            'dom/ShadowRoot.cpp',
-            'dom/ShadowRoot.h',
             'dom/SimulatedClickOptions.h',
             'dom/SpaceSplitString.cpp',
             'dom/StaticNodeList.cpp',
@@ -1914,6 +1905,20 @@
             'dom/default/PlatformMessagePortChannel.h',
             'dom/default/chromium/PlatformMessagePortChannelChromium.cpp',
             'dom/default/chromium/PlatformMessagePortChannelChromium.h',
+            'dom/shadow/ComposedShadowTreeWalker.cpp',
+            'dom/shadow/ComposedShadowTreeWalker.h',
+            'dom/shadow/ContentDistributor.cpp',
+            'dom/shadow/ContentDistributor.h',
+            'dom/shadow/ContentSelectorQuery.cpp',
+            'dom/shadow/ContentSelectorQuery.h',
+            'dom/shadow/ElementShadow.cpp',
+            'dom/shadow/ElementShadow.h',
+            'dom/shadow/InsertionPoint.cpp',
+            'dom/shadow/InsertionPoint.h',
+            'dom/shadow/SelectRuleFeatureSet.cpp',
+            'dom/shadow/SelectRuleFeatureSet.h',
+            'dom/shadow/ShadowRoot.cpp',
+            'dom/shadow/ShadowRoot.h',
         ],
         'webcore_html_files': [
             'html/BaseButtonInputType.cpp',
@@ -1950,8 +1955,6 @@
             'html/DateInputType.h',
             'html/DateTimeFieldsState.cpp',
             'html/DateTimeFieldsState.h',
-            'html/DateTimeInputType.cpp',
-            'html/DateTimeInputType.h',
             'html/DateTimeLocalInputType.cpp',
             'html/DateTimeLocalInputType.h',
             'html/EmailInputType.cpp',
@@ -2342,10 +2345,6 @@
             'html/shadow/PickerIndicatorElement.h',
             'html/shadow/ClearButtonElement.cpp',
             'html/shadow/ClearButtonElement.h',
-            'html/shadow/ContentDistributor.cpp',
-            'html/shadow/ContentDistributor.h',
-            'html/shadow/ContentSelectorQuery.cpp',
-            'html/shadow/ContentSelectorQuery.h',
             'html/shadow/DateTimeEditElement.cpp',
             'html/shadow/DateTimeEditElement.h',
             'html/shadow/DateTimeFieldElement.cpp',
@@ -2362,8 +2361,6 @@
             'html/shadow/HTMLContentElement.h',
             'html/shadow/HTMLShadowElement.cpp',
             'html/shadow/HTMLShadowElement.h',
-            'html/shadow/InsertionPoint.cpp',
-            'html/shadow/InsertionPoint.h',
             'html/shadow/MediaControls.cpp',
             'html/shadow/MediaControls.h',
             'html/shadow/MediaControlElementTypes.cpp',
@@ -2378,8 +2375,6 @@
             'html/shadow/MeterShadowElement.h',
             'html/shadow/ProgressShadowElement.cpp',
             'html/shadow/ProgressShadowElement.h',
-            'html/shadow/SelectRuleFeatureSet.cpp',
-            'html/shadow/SelectRuleFeatureSet.h',
             'html/shadow/SliderThumbElement.cpp',
             'html/shadow/SliderThumbElement.h',
             'html/shadow/SpinButtonElement.cpp',
@@ -2439,12 +2434,10 @@
             'platform/Decimal.cpp',
             'platform/DragData.cpp',
             'platform/DragImage.cpp',
-            'platform/EventLoop.h',
             'platform/FileChooser.cpp',
             'platform/FileIconLoader.cpp',
             'platform/FileIconLoader.h',
             'platform/FileMetadata.h',
-            'platform/FileStream.cpp',
             'platform/FloatConversion.h',
             'platform/HashTools.h',
             'platform/KillRing.h',
@@ -2585,7 +2578,6 @@
             'platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp',
             'platform/audio/ffmpeg/FFTFrameFFMPEG.cpp',
             'platform/audio/mac/FFTFrameMac.cpp',
-            'platform/audio/mkl/FFTFrameMKL.cpp',
             'platform/audio/ipp/FFTFrameIPP.cpp',
             'platform/chromium/ChromiumDataObject.cpp',
             'platform/chromium/ChromiumDataObject.h',
@@ -3088,6 +3080,7 @@
             'platform/text/AtomicStringKeyedMRUCache.h',
             'platform/text/BidiContext.cpp',
             'platform/text/DateTimeFormat.cpp',
+            'platform/text/Hyphenation.cpp',
             'platform/text/Hyphenation.h',
             'platform/text/LineEnding.cpp',
             'platform/text/LocaleICU.cpp',
@@ -3106,6 +3099,7 @@
             'platform/text/TextBoundaries.cpp',
             'platform/text/TextBreakIterator.cpp',
             'platform/text/TextBreakIteratorICU.cpp',
+            'platform/text/TextBreakIteratorInternalICU.cpp',
             'platform/text/TextEncodingDetector.h',
             'platform/text/TextEncodingDetectorICU.cpp',
             'platform/text/TextStream.cpp',
@@ -3114,8 +3108,6 @@
             'platform/text/cf/HyphenationCF.cpp',
             'platform/text/cf/StringCF.cpp',
             'platform/text/cf/StringImplCF.cpp',
-            'platform/text/chromium/Hyphenation.cpp',
-            'platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp',
             'platform/text/mac/LocaleMac.h',
             'platform/text/mac/LocaleMac.mm',
             'platform/text/mac/StringImplMac.mm',
@@ -3605,6 +3597,7 @@
             'platform/chromium/support/WebActiveGestureAnimation.h',
             'platform/chromium/support/WebAudioBus.cpp',
             'platform/chromium/support/WebCString.cpp',
+            'platform/chromium/support/WebCursorInfo.cpp',
             'platform/chromium/support/WebData.cpp',
             'platform/chromium/support/WebFilterOperation.cpp',
             'platform/chromium/support/WebFilterOperations.cpp',
@@ -3627,6 +3620,8 @@
             'platform/chromium/support/WebRTCVoidRequest.cpp',
             'platform/chromium/support/WebScrollbarImpl.cpp',
             'platform/chromium/support/WebScrollbarImpl.h',
+            'platform/chromium/support/WebScrollbarThemeClientImpl.cpp',
+            'platform/chromium/support/WebScrollbarThemeClientImpl.h',
             'platform/chromium/support/WebScrollbarThemeGeometryNative.cpp',
             'platform/chromium/support/WebScrollbarThemeGeometryNative.h',
             'platform/chromium/support/WebSocketStreamError.cpp',
@@ -3647,12 +3642,12 @@
             'platform/chromium/support/WrappedResourceResponse.h',
         ],
         'core_unittest_files': [
+            'animation/DocumentTimelineTest.cpp',
             'platform/DecimalTest.cpp',
             'platform/chromium/ClipboardChromiumTest.cpp',
             'platform/graphics/chromium/AnimationTranslationUtilTest.cpp',
             'platform/text/DateTimeFormatTest.cpp',
             'tests/CachedImageTest.cpp',
-            'tests/DocumentTimeline.cpp',
             'tests/HeapGraphSerializerTest.cpp',
             'tests/LayoutUnit.cpp',
             'tests/LinkRelAttribute.cpp',
@@ -3663,6 +3658,8 @@
             'scripts/in_generator.py',
             'scripts/license.py',
             'scripts/name_macros.py',
+            'scripts/template_expander.py',
+            'scripts/templates/macros.tmpl',
         ],
         'conditions': [
             ['OS=="win"', {
diff --git a/Source/core/css/DOMWindowCSS.idl b/Source/core/css/CSS.idl
similarity index 96%
rename from Source/core/css/DOMWindowCSS.idl
rename to Source/core/css/CSS.idl
index f835815..133d905 100644
--- a/Source/core/css/DOMWindowCSS.idl
+++ b/Source/core/css/CSS.idl
@@ -29,11 +29,9 @@
 
 [
     NoInterfaceObject,
-    InterfaceName=CSS,
+    ImplementedAs=DOMWindowCSS,
     ImplementationLacksVTable
-] interface DOMWindowCSS {
-
+] interface CSS {
     boolean supports(DOMString property, DOMString value);
     boolean supports(DOMString conditionText);
-
 };
diff --git a/Source/core/css/CSSCalculationValue.cpp b/Source/core/css/CSSCalculationValue.cpp
index 74737f8..b1ec9ea 100644
--- a/Source/core/css/CSSCalculationValue.cpp
+++ b/Source/core/css/CSSCalculationValue.cpp
@@ -452,7 +452,7 @@
         if (!value || !value->isPrimitiveValue())
             return false;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value.get());
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get());
         result->value = CSSCalcPrimitiveValue::create(primitiveValue, parserValue->isInt);
 
         ++*index;
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index 972666e..c13bfc1 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -915,7 +915,7 @@
             DropShadowFilterOperation* dropShadowOperation = static_cast<DropShadowFilterOperation*>(filterOperation);
             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::DropShadowFilterOperation);
             // We want our computed style to look like that of a text shadow (has neither spread nor inset style).
-            ShadowData shadowData = ShadowData(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, false, dropShadowOperation->color());
+            ShadowData shadowData = ShadowData(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, dropShadowOperation->color());
             filterValue->append(valueForShadow(&shadowData, CSSPropertyTextShadow, style));
             break;
         }
@@ -2841,7 +2841,7 @@
         RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier);
         if (style && style->fontDescription().keywordSize()) {
             int sizeValue = cssIdentifierForFontSizeKeyword(style->fontDescription().keywordSize());
-            const CSSPrimitiveValue* primitiveValue = static_cast<const CSSPrimitiveValue*>(propertyValue);
+            const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(propertyValue);
             if (primitiveValue->isIdent() && primitiveValue->getIdent() == sizeValue)
                 return true;
         }
diff --git a/Source/core/css/CSSCrossfadeValue.cpp b/Source/core/css/CSSCrossfadeValue.cpp
index 784fc0a..c6dd028 100644
--- a/Source/core/css/CSSCrossfadeValue.cpp
+++ b/Source/core/css/CSSCrossfadeValue.cpp
@@ -42,7 +42,7 @@
 static bool subimageIsPending(CSSValue* value)
 {
     if (value->isImageValue())
-        return static_cast<CSSImageValue*>(value)->cachedOrPendingImage()->isPendingImage();
+        return toCSSImageValue(value)->cachedOrPendingImage()->isPendingImage();
     
     if (value->isImageGeneratorValue())
         return static_cast<CSSImageGeneratorValue*>(value)->isPending();
@@ -55,7 +55,7 @@
 static bool subimageKnownToBeOpaque(CSSValue* value, const RenderObject* renderer)
 {
     if (value->isImageValue())
-        return static_cast<CSSImageValue*>(value)->knownToBeOpaque(renderer);
+        return toCSSImageValue(value)->knownToBeOpaque(renderer);
 
     if (value->isImageGeneratorValue())
         return static_cast<CSSImageGeneratorValue*>(value)->knownToBeOpaque(renderer);
@@ -71,7 +71,7 @@
         return 0;
 
     if (value->isImageValue()) {
-        StyleCachedImage* styleCachedImage = static_cast<CSSImageValue*>(value)->cachedImage(cachedResourceLoader);
+        StyleCachedImage* styleCachedImage = toCSSImageValue(value)->cachedImage(cachedResourceLoader);
         if (!styleCachedImage)
             return 0;
 
diff --git a/Source/core/css/CSSCursorImageValue.cpp b/Source/core/css/CSSCursorImageValue.cpp
index bf4f318..3e7e718 100644
--- a/Source/core/css/CSSCursorImageValue.cpp
+++ b/Source/core/css/CSSCursorImageValue.cpp
@@ -74,7 +74,7 @@
 
     HashSet<SVGElement*>::const_iterator it = m_referencedElements.begin();
     HashSet<SVGElement*>::const_iterator end = m_referencedElements.end();
-    String url = static_cast<CSSImageValue*>(m_imageValue.get())->url();
+    String url = toCSSImageValue(m_imageValue.get())->url();
 
     for (; it != end; ++it) {
         SVGElement* referencedElement = *it;
@@ -109,7 +109,7 @@
     if (!isSVGCursor())
         return false;
 
-    String url = static_cast<CSSImageValue*>(m_imageValue.get())->url();
+    String url = toCSSImageValue(m_imageValue.get())->url();
     if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) {
         // FIXME: This will override hot spot specified in CSS, which is probably incorrect.
         SVGLengthContext lengthContext(0);
@@ -147,7 +147,7 @@
         // to change the URL of the CSSImageValue (which would then change behavior like cssText),
         // we create an alternate CSSImageValue to use.
         if (isSVGCursor() && loader && loader->document()) {
-            RefPtr<CSSImageValue> imageValue = static_cast<CSSImageValue*>(m_imageValue.get());
+            RefPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get());
             // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
             if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(imageValue->url(), loader->document())) {
                 RefPtr<CSSImageValue> svgImageValue = CSSImageValue::create(cursorElement->href());
@@ -159,7 +159,7 @@
 #endif
 
         if (m_imageValue->isImageValue())
-            m_image = static_cast<CSSImageValue*>(m_imageValue.get())->cachedImage(loader);
+            m_image = toCSSImageValue(m_imageValue.get())->cachedImage(loader);
     }
 
     if (m_image && m_image->isCachedImage())
@@ -184,7 +184,7 @@
 bool CSSCursorImageValue::isSVGCursor() const
 {
     if (m_imageValue->isImageValue()) {
-        RefPtr<CSSImageValue> imageValue = static_cast<CSSImageValue*>(m_imageValue.get());
+        RefPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get());
         KURL kurl(ParsedURLString, imageValue->url());
         return kurl.hasFragmentIdentifier();
     }
diff --git a/Source/core/css/CSSFontFaceSource.cpp b/Source/core/css/CSSFontFaceSource.cpp
index 7365dc6..40a5a7d 100644
--- a/Source/core/css/CSSFontFaceSource.cpp
+++ b/Source/core/css/CSSFontFaceSource.cpp
@@ -31,9 +31,11 @@
 #include "core/dom/Document.h"
 #include "core/loader/cache/CachedFont.h"
 #include "core/loader/cache/CachedResourceLoader.h"
+#include "core/platform/HistogramSupport.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/FontDescription.h"
 #include "core/platform/graphics/SimpleFontData.h"
+#include "wtf/CurrentTime.h"
 
 #if ENABLE(SVG_FONTS)
 #include "SVGNames.h"
@@ -91,6 +93,7 @@
     pruneTable();
     if (m_face)
         m_face->fontLoaded(this);
+    m_histograms.recordRemoteFont(m_font.get());
 }
 
 PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
@@ -106,7 +109,9 @@
     ) {
         // We're local. Just return a SimpleFontData from the normal cache.
         // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter.
-        return fontCache()->getCachedFontData(fontDescription, m_string, true);
+        RefPtr<SimpleFontData> fontData = fontCache()->getCachedFontData(fontDescription, m_string, true);
+        m_histograms.recordLocalFont(fontData);
+        return fontData;
     }
 
     // See if we have a mapping in our FontData cache.
@@ -178,6 +183,8 @@
         // and the loader may invoke arbitrary delegate or event handler code.
         fontSelector->beginLoadingFontSoon(m_font.get());
 
+        m_histograms.loadStarted();
+
         // This temporary font is not retained and should not be returned.
         FontCachePurgePreventer fontCachePurgePreventer;
         SimpleFontData* temporaryFont = fontCache()->getNonRetainedLastResortFallbackFont(fontDescription);
@@ -222,4 +229,44 @@
     return m_font->ensureCustomFontData();
 }
 
+void CSSFontFaceSource::FontLoadHistograms::loadStarted()
+{
+    if (!m_loadStartTime)
+        m_loadStartTime = currentTimeMS();
+}
+
+void CSSFontFaceSource::FontLoadHistograms::recordLocalFont(bool loadSuccess)
+{
+    if (!m_loadStartTime) {
+        HistogramSupport::histogramEnumeration("WebFont.LocalFontUsed", loadSuccess ? 1 : 0, 2);
+        m_loadStartTime = -1; // Do not count this font again.
+    }
+}
+
+void CSSFontFaceSource::FontLoadHistograms::recordRemoteFont(const CachedFont* font)
+{
+    if (m_loadStartTime > 0 && font && !font->isLoading()) {
+        int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
+        HistogramSupport::histogramCustomCounts(histogramName(font), duration, 0, 10000, 50);
+        m_loadStartTime = -1;
+    }
+}
+
+const char* CSSFontFaceSource::FontLoadHistograms::histogramName(const CachedFont* font)
+{
+    if (font->errorOccurred())
+        return "WebFont.LoadTime.LoadError";
+
+    unsigned size = font->encodedSize();
+    if (size < 10 * 1024)
+        return "WebFont.LoadTime.0.Under10KB";
+    if (size < 50 * 1024)
+        return "WebFont.LoadTime.1.10KBTo50KB";
+    if (size < 100 * 1024)
+        return "WebFont.LoadTime.2.50KBTo100KB";
+    if (size < 1024 * 1024)
+        return "WebFont.LoadTime.3.100KBTo1MB";
+    return "WebFont.LoadTime.4.Over1MB";
+}
+
 }
diff --git a/Source/core/css/CSSFontFaceSource.h b/Source/core/css/CSSFontFaceSource.h
index 9e9f9ea..bd24171 100644
--- a/Source/core/css/CSSFontFaceSource.h
+++ b/Source/core/css/CSSFontFaceSource.h
@@ -74,12 +74,24 @@
     bool ensureFontData();
 
 private:
+    class FontLoadHistograms {
+    public:
+        FontLoadHistograms() : m_loadStartTime(0) { }
+        void loadStarted();
+        void recordLocalFont(bool loadSuccess);
+        void recordRemoteFont(const CachedFont*);
+    private:
+        const char* histogramName(const CachedFont*);
+        double m_loadStartTime;
+    };
+
     void startLoadingTimerFired(Timer<CSSFontFaceSource>*);
 
     AtomicString m_string; // URI for remote, built-in font name for local.
     CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource.
     CSSFontFace* m_face; // Our owning font face.
     HashMap<unsigned, RefPtr<SimpleFontData> > m_fontDataTable; // The hash key is composed of size synthetic styles.
+    FontLoadHistograms m_histograms;
 
 #if ENABLE(SVG_FONTS)
     RefPtr<SVGFontFaceElement> m_svgFontFaceElement;
diff --git a/Source/core/css/CSSFontSelector.cpp b/Source/core/css/CSSFontSelector.cpp
index 356f23f..8b9712c 100644
--- a/Source/core/css/CSSFontSelector.cpp
+++ b/Source/core/css/CSSFontSelector.cpp
@@ -95,15 +95,15 @@
     if (!fontFamily || !src || !fontFamily->isValueList() || !src->isValueList() || (unicodeRange && !unicodeRange->isValueList()))
         return;
 
-    CSSValueList* familyList = static_cast<CSSValueList*>(fontFamily.get());
+    CSSValueList* familyList = toCSSValueList(fontFamily.get());
     if (!familyList->length())
         return;
 
-    CSSValueList* srcList = static_cast<CSSValueList*>(src.get());
+    CSSValueList* srcList = toCSSValueList(src.get());
     if (!srcList->length())
         return;
 
-    CSSValueList* rangeList = static_cast<CSSValueList*>(unicodeRange.get());
+    CSSValueList* rangeList = toCSSValueList(unicodeRange.get());
 
     unsigned traitsMask = 0;
 
@@ -111,7 +111,7 @@
         if (!fontStyle->isPrimitiveValue())
             return;
 
-        switch (static_cast<CSSPrimitiveValue*>(fontStyle.get())->getIdent()) {
+        switch (toCSSPrimitiveValue(fontStyle.get())->getIdent()) {
         case CSSValueNormal:
             traitsMask |= FontStyleNormalMask;
             break;
@@ -129,7 +129,7 @@
         if (!fontWeight->isPrimitiveValue())
             return;
 
-        switch (static_cast<CSSPrimitiveValue*>(fontWeight.get())->getIdent()) {
+        switch (toCSSPrimitiveValue(fontWeight.get())->getIdent()) {
         case CSSValueBold:
         case CSSValue700:
             traitsMask |= FontWeight700Mask;
@@ -174,13 +174,13 @@
         } else if (!fontVariant->isValueList())
             return;
 
-        CSSValueList* variantList = static_cast<CSSValueList*>(fontVariant.get());
+        CSSValueList* variantList = toCSSValueList(fontVariant.get());
         unsigned numVariants = variantList->length();
         if (!numVariants)
             return;
 
         for (unsigned i = 0; i < numVariants; ++i) {
-            switch (static_cast<CSSPrimitiveValue*>(variantList->itemWithoutBoundsCheck(i))->getIdent()) {
+            switch (toCSSPrimitiveValue(variantList->itemWithoutBoundsCheck(i))->getIdent()) {
                 case CSSValueNormal:
                     traitsMask |= FontVariantNormalMask;
                     break;
@@ -258,7 +258,7 @@
     // Hash under every single family name.
     int familyLength = familyList->length();
     for (int i = 0; i < familyLength; i++) {
-        CSSPrimitiveValue* item = static_cast<CSSPrimitiveValue*>(familyList->itemWithoutBoundsCheck(i));
+        CSSPrimitiveValue* item = toCSSPrimitiveValue(familyList->itemWithoutBoundsCheck(i));
         String familyName;
         if (item->isString())
             familyName = item->getStringValue();
diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in
index f9cd738..7eac66e 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -50,7 +50,7 @@
     Vector<RefPtr<StyleKeyframe> >* keyframeRuleList;
     float val;
     CSSPropertyID id;
-    CSSParser::Location location;
+    CSSParserLocation location;
 }
 
 %{
@@ -87,7 +87,7 @@
 
 %}
 
-%expect 33
+%expect 32
 
 %nonassoc LOWEST_PREC
 
@@ -300,12 +300,14 @@
 %type <character> operator
 
 %type <valueList> expr
+%type <valueList> valid_expr
 %type <value> term
 %type <value> unary_term
 %type <value> function
 %type <value> calc_func_term
 %type <character> calc_func_operator
 %type <valueList> calc_func_expr
+%type <valueList> valid_calc_func_expr
 %type <valueList> calc_func_expr_list
 %type <valueList> calc_func_paren_expr
 %type <value> calc_function
@@ -821,7 +823,7 @@
     ;
 
 keyframe_rule:
-    key_list maybe_space '{' maybe_space declaration_list '}' {
+    key_list maybe_space '{' maybe_space declaration_list closing_brace {
         $$ = parser->createKeyframe($1);
     }
     ;
@@ -1618,11 +1620,16 @@
   ;
 
 expr:
+    valid_expr
+    | valid_expr expr_recovery { $$ = 0; }
+  ;
+
+valid_expr:
     term {
         $$ = parser->createFloatingValueList();
         $$->addValue(parser->sinkFloatingValue($1));
     }
-    | expr operator term {
+    | valid_expr operator term {
         $$ = $1;
         if ($$) {
             if ($2) {
@@ -1635,9 +1642,6 @@
             $$->addValue(parser->sinkFloatingValue($3));
         }
     }
-    | expr expr_recovery {
-        $$ = 0;
-    }
   ;
 
 expr_recovery:
@@ -1672,19 +1676,19 @@
   | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; }
   | HEX maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; }
   | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */
-  | VARFUNCTION maybe_space IDENT ')' maybe_space {
+  | VARFUNCTION maybe_space IDENT closing_parenthesis maybe_space {
       $$.id = 0;
       $$.string = $3;
       $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
   }
   /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */
-  | function {
+  | function maybe_space {
       $$ = $1;
   }
-  | calc_function {
+  | calc_function maybe_space {
       $$ = $1;
   }
-  | min_or_max_function {
+  | min_or_max_function maybe_space {
       $$ = $1;
   }
   | '%' maybe_space { /* Handle width: %; */
@@ -1732,7 +1736,7 @@
   ;
 
 function:
-    FUNCTION maybe_space expr closing_parenthesis maybe_space {
+    FUNCTION maybe_space expr closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = parser->sinkFloatingValueList($3);
@@ -1740,7 +1744,7 @@
         $$.unit = CSSParserValue::Function;
         $$.function = f;
     } |
-    FUNCTION maybe_space closing_parenthesis maybe_space {
+    FUNCTION maybe_space closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         CSSParserValueList* valueList = parser->createFloatingValueList();
@@ -1749,7 +1753,7 @@
         $$.unit = CSSParserValue::Function;
         $$.function = f;
     } |
-    FUNCTION maybe_space error {
+    FUNCTION maybe_space expr_recovery closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = nullptr;
@@ -1761,7 +1765,7 @@
 
 calc_func_term:
   unary_term { $$ = $1; }
-  | VARFUNCTION maybe_space IDENT ')' {
+  | VARFUNCTION maybe_space IDENT closing_parenthesis {
       $$.id = 0;
       $$.string = $3;
       $$.unit = CSSPrimitiveValue::CSS_VARIABLE_NAME;
@@ -1790,7 +1794,7 @@
   ;
 
 calc_func_paren_expr:
-    '(' maybe_space calc_func_expr calc_maybe_space ')' {
+    '(' maybe_space calc_func_expr calc_maybe_space closing_parenthesis {
         if ($3) {
             $$ = $3;
             CSSParserValue v;
@@ -1803,9 +1807,17 @@
         } else
             $$ = 0;
     }
+    | '(' maybe_space expr_recovery closing_parenthesis {
+        YYERROR;
+    }
   ;
 
 calc_func_expr:
+    valid_calc_func_expr
+    | valid_calc_func_expr expr_recovery { $$ = 0; }
+  ;
+
+valid_calc_func_expr:
     calc_func_term {
         $$ = parser->createFloatingValueList();
         $$->addValue(parser->sinkFloatingValue($1));
@@ -1836,9 +1848,6 @@
             $$ = 0;
     }
     | calc_func_paren_expr
-    | calc_func_expr error {
-        $$ = 0;
-    }
   ;
 
 calc_func_expr_list:
@@ -1860,7 +1869,7 @@
   ;
 
 calc_function:
-    CALCFUNCTION maybe_space calc_func_expr calc_maybe_space ')' maybe_space {
+    CALCFUNCTION maybe_space calc_func_expr calc_maybe_space closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = parser->sinkFloatingValueList($3);
@@ -1868,7 +1877,7 @@
         $$.unit = CSSParserValue::Function;
         $$.function = f;
     }
-    | CALCFUNCTION maybe_space error {
+    | CALCFUNCTION maybe_space expr_recovery closing_parenthesis {
         YYERROR;
     }
     ;
@@ -1884,7 +1893,7 @@
     ;
 
 min_or_max_function:
-    min_or_max maybe_space calc_func_expr_list ')' maybe_space {
+    min_or_max maybe_space calc_func_expr_list closing_parenthesis {
         CSSParserFunction* f = parser->createFloatingFunction();
         f->name = $1;
         f->args = parser->sinkFloatingValueList($3);
@@ -1892,7 +1901,7 @@
         $$.unit = CSSParserValue::Function;
         $$.function = f;
     } 
-    | min_or_max maybe_space error {
+    | min_or_max maybe_space expr_recovery closing_parenthesis {
         YYERROR;
     }
     ;
@@ -1956,8 +1965,18 @@
 
 error_recovery:
     /* empty */
-  | error_recovery invalid_block
   | error_recovery error
+  | error_recovery '{' error_recovery closing_brace { parser->invalidBlockHit(); }
+  | error_recovery '[' error_recovery ']'
+  | error_recovery '[' error_recovery TOKEN_EOF
+  | error_recovery '(' error_recovery closing_parenthesis
+  | error_recovery FUNCTION error_recovery closing_parenthesis
+  | error_recovery CALCFUNCTION error_recovery closing_parenthesis
+  | error_recovery VARFUNCTION error_recovery closing_parenthesis
+  | error_recovery MINFUNCTION error_recovery closing_parenthesis
+  | error_recovery MAXFUNCTION error_recovery closing_parenthesis
+  | error_recovery ANYFUNCTION error_recovery closing_parenthesis
+  | error_recovery NOTFUNCTION error_recovery closing_parenthesis
     ;
 
 %%
diff --git a/Source/core/css/CSSImageSetValue.cpp b/Source/core/css/CSSImageSetValue.cpp
index 2ebb859..0697566 100644
--- a/Source/core/css/CSSImageSetValue.cpp
+++ b/Source/core/css/CSSImageSetValue.cpp
@@ -60,14 +60,12 @@
     size_t i = 0;
     while (i < length) {
         CSSValue* imageValue = item(i);
-        ASSERT_WITH_SECURITY_IMPLICATION(imageValue->isImageValue());
-        String imageURL = static_cast<CSSImageValue*>(imageValue)->url();
+        String imageURL = toCSSImageValue(imageValue)->url();
 
         ++i;
         ASSERT_WITH_SECURITY_IMPLICATION(i < length);
         CSSValue* scaleFactorValue = item(i);
-        ASSERT_WITH_SECURITY_IMPLICATION(scaleFactorValue->isPrimitiveValue());
-        float scaleFactor = static_cast<CSSPrimitiveValue*>(scaleFactorValue)->getFloatValue();
+        float scaleFactor = toCSSPrimitiveValue(scaleFactorValue)->getFloatValue();
 
         ImageWithScale image;
         image.imageURL = imageURL;
diff --git a/Source/core/css/CSSImageValue.h b/Source/core/css/CSSImageValue.h
index 87c920d..7b5522c 100644
--- a/Source/core/css/CSSImageValue.h
+++ b/Source/core/css/CSSImageValue.h
@@ -68,6 +68,21 @@
     AtomicString m_initiatorName;
 };
 
+inline CSSImageValue* toCSSImageValue(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isImageValue());
+    return static_cast<CSSImageValue*>(value);
+}
+
+inline const CSSImageValue* toCSSImageValue(const CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isImageValue());
+    return static_cast<const CSSImageValue*>(value);
+}
+
+// Catch unneeded cast.
+void toCSSImageValue(const CSSImageValue*);
+
 } // namespace WebCore
 
 #endif // CSSImageValue_h
diff --git a/Source/core/css/CSSImportRule.cpp b/Source/core/css/CSSImportRule.cpp
index 1c1c321..c1e685d 100644
--- a/Source/core/css/CSSImportRule.cpp
+++ b/Source/core/css/CSSImportRule.cpp
@@ -31,7 +31,7 @@
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/loader/cache/CachedCSSStyleSheet.h"
 #include "core/loader/cache/CachedResourceLoader.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp
index 0135f09..ee0e627 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -79,6 +79,7 @@
 #include "core/css/WebKitCSSTransformValue.h"
 #include "core/dom/Document.h"
 #include "core/html/parser/HTMLParserIdioms.h"
+#include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
 #include "core/page/Settings.h"
@@ -1309,7 +1310,7 @@
     if (!value->isPrimitiveValue())
         return false;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     if (!primitiveValue->isRGBColor())
         return false;
 
@@ -1605,13 +1606,11 @@
     case CSSPrimitiveValue::CSS_TURN:
         b = (unitflags & FAngle);
         break;
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     case CSSPrimitiveValue::CSS_DPPX:
     case CSSPrimitiveValue::CSS_DPI:
     case CSSPrimitiveValue::CSS_DPCM:
         b = (unitflags & FResolution);
         break;
-#endif
     case CSSPrimitiveValue::CSS_HZ:
     case CSSPrimitiveValue::CSS_KHZ:
     case CSSPrimitiveValue::CSS_DIMENSION:
@@ -1633,16 +1632,10 @@
         return CSSPrimitiveValue::create(m_parsedCalculation.release());
     }
 
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
         || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_CHS)
         || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMAX)
         || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiveValue::CSS_DPCM));
-#else
-    ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
-        || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_CHS)
-        || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMAX));
-#endif
     return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
 }
 
@@ -1690,10 +1683,8 @@
         return createPrimitiveNumericValue(value);
     if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMAX)
         return createPrimitiveNumericValue(value);
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiveValue::CSS_DPCM)
         return createPrimitiveNumericValue(value);
-#endif
     if (value->unit == CSSPrimitiveValue::CSS_VARIABLE_NAME)
         return createPrimitiveVariableNameValue(value);
     if (value->unit >= CSSParserValue::Q_EMS)
@@ -2945,7 +2936,7 @@
 {
     if (lval) {
         if (lval->isBaseValueList())
-            static_cast<CSSValueList*>(lval.get())->append(rval);
+            toCSSValueList(lval.get())->append(rval);
         else {
             PassRefPtr<CSSValue> oldlVal(lval.release());
             PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
@@ -3144,7 +3135,7 @@
 {
     if (lval) {
         if (lval->isValueList())
-            static_cast<CSSValueList*>(lval.get())->append(rval);
+            toCSSValueList(lval.get())->append(rval);
         else {
             PassRefPtr<CSSValue> oldVal(lval.release());
             PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
@@ -3863,8 +3854,8 @@
         value1.swap(value2);
 
 #ifndef NDEBUG
-    CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(value1.get());
-    CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(value2.get());
+    CSSPrimitiveValue* first = toCSSPrimitiveValue(value1.get());
+    CSSPrimitiveValue* second = toCSSPrimitiveValue(value2.get());
     ident1 = first->getPairValue()->first()->getIdent();
     ident2 = second->getPairValue()->first()->getIdent();
     ASSERT(ident1 == CSSValueLeft || ident1 == CSSValueRight);
@@ -3924,8 +3915,8 @@
         return;
     }
 
-    RefPtr<CSSPrimitiveValue> parsedValue1 = static_cast<CSSPrimitiveValue*>(value1.get());
-    RefPtr<CSSPrimitiveValue> parsedValue2 = static_cast<CSSPrimitiveValue*>(value2.get());
+    RefPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1.get());
+    RefPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2.get());
 
     value1.clear();
     value2.clear();
@@ -4022,7 +4013,7 @@
 
     // If only one value was specified, value2 is the same as value1.
     m_implicitShorthand = true;
-    value2 = cssValuePool().createIdentifierValue(static_cast<CSSPrimitiveValue*>(value1.get())->getIdent());
+    value2 = cssValuePool().createIdentifierValue(toCSSPrimitiveValue(value1.get())->getIdent());
 }
 
 PassRefPtr<CSSValue> CSSParser::parseFillSize(CSSPropertyID propId, bool& allowComma)
@@ -7200,14 +7191,11 @@
             return false;
     }
 
-    ASSERT(!centerX || centerX->isPrimitiveValue());
-    ASSERT(!centerY || centerY->isPrimitiveValue());
-
-    result->setFirstX(static_cast<CSSPrimitiveValue*>(centerX.get()));
-    result->setSecondX(static_cast<CSSPrimitiveValue*>(centerX.get()));
+    result->setFirstX(toCSSPrimitiveValue(centerX.get()));
+    result->setSecondX(toCSSPrimitiveValue(centerX.get()));
     // CSS3 radial gradients always share the same start and end point.
-    result->setFirstY(static_cast<CSSPrimitiveValue*>(centerY.get()));
-    result->setSecondY(static_cast<CSSPrimitiveValue*>(centerY.get()));
+    result->setFirstY(toCSSPrimitiveValue(centerY.get()));
+    result->setSecondY(toCSSPrimitiveValue(centerY.get()));
 
     RefPtr<CSSPrimitiveValue> shapeValue;
     RefPtr<CSSPrimitiveValue> sizeValue;
@@ -7457,19 +7445,17 @@
             return false;
 
         parseFillPosition(args, centerX, centerY);
-        ASSERT(centerX->isPrimitiveValue());
-        ASSERT(centerY->isPrimitiveValue());
         if (!(centerX && centerY))
             return false;
 
         a = args->current();
         if (!a)
             return false;
-        result->setFirstX(static_cast<CSSPrimitiveValue*>(centerX.get()));
-        result->setFirstY(static_cast<CSSPrimitiveValue*>(centerY.get()));
+        result->setFirstX(toCSSPrimitiveValue(centerX.get()));
+        result->setFirstY(toCSSPrimitiveValue(centerY.get()));
         // Right now, CSS radial gradients have the same start and end centers.
-        result->setSecondX(static_cast<CSSPrimitiveValue*>(centerX.get()));
-        result->setSecondY(static_cast<CSSPrimitiveValue*>(centerY.get()));
+        result->setSecondX(toCSSPrimitiveValue(centerX.get()));
+        result->setSecondY(toCSSPrimitiveValue(centerY.get()));
     }
 
     if (shapeValue || sizeValue || horizontalSize || centerX || centerY)
@@ -9446,9 +9432,9 @@
     return m_tokenStart.ptr16;
 }
 
-CSSParser::Location CSSParser::currentLocation()
+CSSParserLocation CSSParser::currentLocation()
 {
-    Location location;
+    CSSParserLocation location;
     location.lineNumber = m_tokenStartLineNumber;
     if (is8BitSource())
         location.token.init(tokenStart<LChar>(), currentCharacter<LChar>() - tokenStart<LChar>());
@@ -9909,7 +9895,6 @@
     case 'd':
         if (length == 3 && isASCIIAlphaCaselessEqual(type[1], 'e') && isASCIIAlphaCaselessEqual(type[2], 'g'))
             m_token = DEGS;
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
         else if (length > 2 && isASCIIAlphaCaselessEqual(type[1], 'p')) {
             if (length == 4) {
                 // There is a discussion about the name of this unit on www-style.
@@ -9922,7 +9907,6 @@
             } else if (length == 3 && isASCIIAlphaCaselessEqual(type[2], 'i'))
                     m_token = DPI;
         }
-#endif
         return;
 
     case 'e':
@@ -10930,10 +10914,13 @@
     return listPtr;
 }
 
-void CSSParser::syntaxError(const Location& location, SyntaxErrorType error)
+void CSSParser::syntaxError(const CSSParserLocation& location, SyntaxErrorType error)
 {
     if (!isLoggingErrors())
         return;
+    if (!InspectorInstrumentation::cssErrorFilter(location, error))
+        return;
+
     StringBuilder builder;
     switch (error) {
     case PropertyDeclarationError:
@@ -11005,7 +10992,7 @@
         CSSProperty& property = m_parsedProperties[i];
         if (property.id() == CSSPropertyFontVariant && property.value()->isPrimitiveValue())
             property.wrapValueInCommaSeparatedList();
-        else if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) {
+        else if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || toCSSValueList(property.value())->length() != 1)) {
             // Unlike font-family property, font-family descriptor in @font-face rule
             // has to be a value list with exactly one family name. It cannot have a
             // have 'initial' value and cannot 'inherit' from parent.
diff --git a/Source/core/css/CSSParser.h b/Source/core/css/CSSParser.h
index 56f7710..0fbe9fb 100644
--- a/Source/core/css/CSSParser.h
+++ b/Source/core/css/CSSParser.h
@@ -67,11 +67,12 @@
 class WebKitCSSMixFunctionValue;
 class WebKitCSSShaderValue;
 
+struct CSSParserLocation;
+
 class CSSParser {
     friend inline int cssyylex(void*, CSSParser*);
 
 public:
-    struct Location;
     class SourceDataHandler;
     enum SyntaxErrorType {
         NoSyntaxError,
@@ -385,7 +386,7 @@
     void startProperty();
     void endProperty(bool isImportantFound, bool isPropertyParsed, SyntaxErrorType = NoSyntaxError);
     void startEndUnknownRule();
-    void syntaxError(const Location&, SyntaxErrorType = GeneralSyntaxError);
+    void syntaxError(const CSSParserLocation&, SyntaxErrorType = GeneralSyntaxError);
 
     inline int lex(void* yylval) { return (this->*m_lexFunc)(yylval); }
 
@@ -403,7 +404,7 @@
 
     static KURL completeURL(const CSSParserContext&, const String& url);
 
-    Location currentLocation();
+    CSSParserLocation currentLocation();
 
 private:
     bool is8BitSource() { return m_is8BitSource; }
@@ -585,9 +586,7 @@
         FFrequency = 0x0040,
         FPositiveInteger = 0x0080,
         FRelative = 0x0100,
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
         FResolution = 0x0200,
-#endif
         FNonNeg = 0x0400
     };
 
@@ -644,7 +643,7 @@
     CSSParser* m_parser;
 };
 
-struct CSSParser::Location {
+struct CSSParserLocation {
     int lineNumber;
     CSSParserString token;
 };
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index 288dc78..c468b79 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -49,7 +49,7 @@
 using namespace WTF;
 
 namespace WebCore {
-    
+
 // Max/min values for CSS, needs to slightly smaller/larger than the true max/min values to allow for rounding without overflowing.
 // Subtract two (rather than one) to allow for values to be converted to float and back without exceeding the LayoutUnit::max.
 const int maxValueForCssLength = INT_MAX / kFixedPointDenominator - 2;
@@ -64,11 +64,9 @@
     case CSSPrimitiveValue::CSS_CM:
     case CSSPrimitiveValue::CSS_DEG:
     case CSSPrimitiveValue::CSS_DIMENSION:
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     case CSSPrimitiveValue::CSS_DPPX:
     case CSSPrimitiveValue::CSS_DPI:
     case CSSPrimitiveValue::CSS_DPCM:
-#endif
     case CSSPrimitiveValue::CSS_EMS:
     case CSSPrimitiveValue::CSS_EXS:
     case CSSPrimitiveValue::CSS_GRAD:
@@ -96,11 +94,6 @@
     case CSSPrimitiveValue::CSS_ATTR:
     case CSSPrimitiveValue::CSS_COUNTER:
     case CSSPrimitiveValue::CSS_COUNTER_NAME:
-#if !ENABLE(RESOLUTION_MEDIA_QUERY)
-    case CSSPrimitiveValue::CSS_DPPX:
-    case CSSPrimitiveValue::CSS_DPI:
-    case CSSPrimitiveValue::CSS_DPCM:
-#endif
     case CSSPrimitiveValue::CSS_IDENT:
     case CSSPrimitiveValue::CSS_PAIR:
     case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR:
@@ -155,12 +148,10 @@
     case CSSPrimitiveValue::CSS_VMIN:
     case CSSPrimitiveValue::CSS_VMAX:
         return CSSPrimitiveValue::UViewportPercentageLength;
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     case CSSPrimitiveValue::CSS_DPPX:
     case CSSPrimitiveValue::CSS_DPI:
     case CSSPrimitiveValue::CSS_DPCM:
         return CSSPrimitiveValue::UResolution;
-#endif
     default:
         return CSSPrimitiveValue::UOther;
     }
@@ -662,10 +653,8 @@
         return CSS_HZ;
     case UViewportPercentageLength:
         return CSS_UNKNOWN; // Cannot convert between numbers and relative lengths.
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     case UResolution:
         return CSS_DPPX;
-#endif
     default:
         return CSS_UNKNOWN;
     }
@@ -881,7 +870,6 @@
         case CSS_CM:
             text = formatNumber(m_value.num, "cm");
             break;
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
         case CSS_DPPX:
             text = formatNumber(m_value.num, "dppx");
             break;
@@ -891,7 +879,6 @@
         case CSS_DPCM:
             text = formatNumber(m_value.num, "dpcm");
             break;
-#endif
         case CSS_MM:
             text = formatNumber(m_value.num, "mm");
             break;
@@ -1174,11 +1161,9 @@
     case CSS_VH:
     case CSS_VMIN:
     case CSS_VMAX:
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     case CSS_DPPX:
     case CSS_DPI:
     case CSS_DPCM:
-#endif
         result = CSSPrimitiveValue::create(m_value.num, static_cast<UnitTypes>(m_primitiveUnitType));
         break;
     case CSS_IDENT:
@@ -1217,11 +1202,9 @@
     case CSS_REMS:
     case CSS_PX:
     case CSS_CM:
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     case CSS_DPPX:
     case CSS_DPI:
     case CSS_DPCM:
-#endif
     case CSS_MM:
     case CSS_IN:
     case CSS_PT:
diff --git a/Source/core/css/CSSPrimitiveValue.h b/Source/core/css/CSSPrimitiveValue.h
index dc3dc30..2284218 100644
--- a/Source/core/css/CSSPrimitiveValue.h
+++ b/Source/core/css/CSSPrimitiveValue.h
@@ -139,9 +139,7 @@
         UTime,
         UFrequency,
         UViewportPercentageLength,
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
         UResolution,
-#endif
         UOther
     };
 
@@ -183,6 +181,11 @@
     bool isDotsPerInch() const { return primitiveType() == CSS_DPI; }
     bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; }
     bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; }
+    bool isResolution() const
+    {
+        unsigned short type = primitiveType();
+        return type >= CSS_DPPX && type <= CSS_DPCM;
+    }
     bool isVariableName() const { return primitiveType() == CSS_VARIABLE_NAME; }
     bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_VW && m_primitiveUnitType <= CSS_VMAX; }
     bool isFlex() const { return primitiveType() == CSS_FR; }
@@ -361,6 +364,21 @@
     } m_value;
 };
 
+inline CSSPrimitiveValue* toCSSPrimitiveValue(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isPrimitiveValue());
+    return static_cast<CSSPrimitiveValue*>(value);
+}
+
+inline const CSSPrimitiveValue* toCSSPrimitiveValue(const CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isPrimitiveValue());
+    return static_cast<const CSSPrimitiveValue*>(value);
+}
+
+// Catch unneeded cast.
+void toCSSPrimitiveValue(const CSSPrimitiveValue*);
+
 } // namespace WebCore
 
 #endif // CSSPrimitiveValue_h
diff --git a/Source/core/css/CSSProperty.cpp b/Source/core/css/CSSProperty.cpp
index 3c99ca4..93282bd 100644
--- a/Source/core/css/CSSProperty.cpp
+++ b/Source/core/css/CSSProperty.cpp
@@ -42,7 +42,7 @@
 {
     RefPtr<CSSValue> value = m_value.release();
     m_value = CSSValueList::createCommaSeparated();
-    static_cast<CSSValueList*>(m_value.get())->append(value.release());
+    toCSSValueList(m_value.get())->append(value.release());
 }
 
 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };
diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h
index 7c7db93..526c737 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -361,14 +361,6 @@
     m_data.m_value->ref();
 }
 
-inline void move(PassOwnPtr<CSSSelector> from, CSSSelector* to)
-{
-    memcpy(to, from.get(), sizeof(CSSSelector));
-    // We want to free the memory (which was allocated with fastNew), but we
-    // don't want the destructor to run since it will affect the copy we've just made.
-    fastFree(from.leakPtr());
-}
-
 inline CSSSelector::CSSSelector()
     : m_relation(Descendant)
     , m_match(Unknown)
diff --git a/Source/core/css/CSSSelectorList.cpp b/Source/core/css/CSSSelectorList.cpp
index fafba10..75a4bba 100644
--- a/Source/core/css/CSSSelectorList.cpp
+++ b/Source/core/css/CSSSelectorList.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2012 Apple Inc. All rights reserved.
  * Copyright (C) 2009 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,17 +38,12 @@
     deleteSelectors();
 }
 
-CSSSelectorList::CSSSelectorList(const CSSSelectorList& o)
+CSSSelectorList::CSSSelectorList(const CSSSelectorList& other)
 {
-    unsigned length = o.length();
-    if (length == 1) {
-        // Destructor expects a single selector to be allocated by new, multiple with fastMalloc.
-        m_selectorArray = new CSSSelector(o.m_selectorArray[0]);
-        return;
-    }
-    m_selectorArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * length));
-    for (unsigned i = 0; i < length; ++i)
-        new (&m_selectorArray[i]) CSSSelector(o.m_selectorArray[i]);
+    unsigned otherLength = other.length();
+    m_selectorArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * otherLength));
+    for (unsigned i = 0; i < otherLength; ++i)
+        new (&m_selectorArray[i]) CSSSelector(other.m_selectorArray[i]);
 }
 
 void CSSSelectorList::adopt(CSSSelectorList& list)
@@ -61,28 +56,23 @@
 void CSSSelectorList::adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector)
 {
     deleteSelectors();
-    const size_t vectorSize = selectorVector.size();
     size_t flattenedSize = 0;
-    for (size_t i = 0; i < vectorSize; ++i) {
+    for (size_t i = 0; i < selectorVector.size(); ++i) {
         for (CSSParserSelector* selector = selectorVector[i].get(); selector; selector = selector->tagHistory())
             ++flattenedSize;
     }
     ASSERT(flattenedSize);
-    if (flattenedSize == 1) {
-        m_selectorArray = selectorVector[0]->releaseSelector().leakPtr();
-        m_selectorArray->setLastInSelectorList();
-        ASSERT(m_selectorArray->isLastInTagHistory());
-        selectorVector.shrink(0);
-        return;
-    }
     m_selectorArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * flattenedSize));
     size_t arrayIndex = 0;
-    for (size_t i = 0; i < vectorSize; ++i) {
+    for (size_t i = 0; i < selectorVector.size(); ++i) {
         CSSParserSelector* current = selectorVector[i].get();
         while (current) {
-            OwnPtr<CSSSelector> selector = current->releaseSelector();
+            // Move item from the parser selector vector into m_selectorArray without invoking destructor (Ugh.)
+            CSSSelector* currentSelector = current->releaseSelector().leakPtr();
+            memcpy(&m_selectorArray[arrayIndex], currentSelector, sizeof(CSSSelector));
+            fastFree(currentSelector);
+
             current = current->tagHistory();
-            move(selector.release(), &m_selectorArray[arrayIndex]);
             ASSERT(!m_selectorArray[arrayIndex].isLastInSelectorList());
             if (current)
                 m_selectorArray[arrayIndex].setNotLastInTagHistory();
@@ -92,7 +82,7 @@
     }
     ASSERT(flattenedSize == arrayIndex);
     m_selectorArray[arrayIndex - 1].setLastInSelectorList();
-    selectorVector.shrink(0);
+    selectorVector.clear();
 }
 
 unsigned CSSSelectorList::length() const
@@ -110,24 +100,9 @@
     if (!m_selectorArray)
         return;
 
-    // We had two cases in adoptSelectVector. The fast case of a 1 element
-    // vector took the CSSSelector directly, which was allocated with new.
-    // The second case we allocated a new fastMalloc buffer, which should be
-    // freed with fastFree, and the destructors called manually.
-    CSSSelector* s = m_selectorArray;
-    bool done = s->isLastInSelectorList();
-    if (done)
-        delete s;
-    else {
-        while (1) {
-            s->~CSSSelector();
-            if (done)
-                break;
-            ++s;
-            done = s->isLastInSelectorList();
-        }
-        fastFree(m_selectorArray);
-    }
+    for (CSSSelector* s = m_selectorArray; !s->isLastInSelectorList(); ++s)
+        s->~CSSSelector();
+    fastFree(m_selectorArray);
 }
 
 String CSSSelectorList::selectorsText() const
diff --git a/Source/core/css/CSSStyleDeclaration.idl b/Source/core/css/CSSStyleDeclaration.idl
index be7b708..9efa6b6 100644
--- a/Source/core/css/CSSStyleDeclaration.idl
+++ b/Source/core/css/CSSStyleDeclaration.idl
@@ -39,9 +39,5 @@
     readonly attribute unsigned long    length;
     getter DOMString          item([Default=Undefined] optional unsigned long index);
     readonly attribute CSSRule          parentRule;
-
-    // Extensions
-    [TreatReturnedNullStringAs=Null] DOMString          getPropertyShorthand([Default=Undefined] optional DOMString propertyName);
-    boolean            isPropertyImplicit([Default=Undefined] optional DOMString propertyName);
 };
 
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index 2c1017d..e400e08 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -39,7 +39,7 @@
 #include "core/dom/Node.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/loader/cache/CachedCSSStyleSheet.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
@@ -207,10 +207,8 @@
     if (m_mediaCSSOMWrapper && m_mediaQueries)
         m_mediaCSSOMWrapper->reattach(m_mediaQueries.get());
 
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     // Add warning message to inspector whenever dpi/dpcm values are used for "screen" media.
     reportMediaQueryWarningIfNeeded(ownerDocument(), m_mediaQueries.get());
-#endif
 }
 
 unsigned CSSStyleSheet::length() const
@@ -227,7 +225,7 @@
     if (m_childRuleCSSOMWrappers.isEmpty())
         m_childRuleCSSOMWrappers.grow(ruleCount);
     ASSERT(m_childRuleCSSOMWrappers.size() == ruleCount);
-    
+
     RefPtr<CSSRule>& cssRule = m_childRuleCSSOMWrappers[index];
     if (!cssRule) {
         if (index == 0 && m_contents->hasCharsetRule()) {
diff --git a/Source/core/css/CSSToStyleMap.cpp b/Source/core/css/CSSToStyleMap.cpp
index f940e29..e9960c3 100644
--- a/Source/core/css/CSSToStyleMap.cpp
+++ b/Source/core/css/CSSToStyleMap.cpp
@@ -71,7 +71,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     switch (primitiveValue->getIdent()) {
     case CSSValueFixed:
         layer->setAttachment(FixedBackgroundAttachment);
@@ -97,7 +97,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     layer->setClip(*primitiveValue);
 }
 
@@ -111,7 +111,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     layer->setComposite(*primitiveValue);
 }
 
@@ -125,7 +125,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     layer->setBlendMode(*primitiveValue);
 }
 
@@ -139,7 +139,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     layer->setOrigin(*primitiveValue);
 }
 
@@ -164,7 +164,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     layer->setRepeatX(*primitiveValue);
 }
 
@@ -178,7 +178,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     layer->setRepeatY(*primitiveValue);
 }
 
@@ -189,7 +189,7 @@
         return;
     }
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     if (primitiveValue->getIdent() == CSSValueContain)
         layer->setSizeType(Contain);
     else if (primitiveValue->getIdent() == CSSValueCover)
@@ -210,10 +210,8 @@
     Length secondLength;
 
     if (Pair* pair = primitiveValue->getPairValue()) {
-        CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first());
-        CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second());
-        firstLength = first->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
-        secondLength = second->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
+        firstLength = pair->first()->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
+        secondLength = pair->second()->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
     } else {
         firstLength = primitiveValue->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
         secondLength = Length();
@@ -239,7 +237,7 @@
 
     float zoomFactor = style()->effectiveZoom();
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     Pair* pair = primitiveValue->getPairValue();
     if (pair) {
         ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPositionX || propertyID == CSSPropertyWebkitMaskPositionX);
@@ -275,7 +273,7 @@
 
     float zoomFactor = style()->effectiveZoom();
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     Pair* pair = primitiveValue->getPairValue();
     if (pair) {
         ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPositionY || propertyID == CSSPropertyWebkitMaskPositionY);
@@ -309,7 +307,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     animation->setDelay(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
@@ -323,7 +321,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     switch (primitiveValue->getIdent()) {
     case CSSValueNormal:
         layer->setDirection(CSSAnimationData::AnimationDirectionNormal);
@@ -350,7 +348,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     animation->setDuration(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
@@ -364,7 +362,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     switch (primitiveValue->getIdent()) {
     case CSSValueNone:
         layer->setFillMode(AnimationFillModeNone);
@@ -391,7 +389,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     if (primitiveValue->getIdent() == CSSValueInfinite)
         animation->setIterationCount(CSSAnimationData::IterationCountInfinite);
     else
@@ -408,7 +406,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     if (primitiveValue->getIdent() == CSSValueNone)
         layer->setIsNoneAnimation(true);
     else
@@ -425,7 +423,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     EAnimPlayState playState = (primitiveValue->getIdent() == CSSValuePaused) ? AnimPlayStatePaused : AnimPlayStatePlaying;
     layer->setPlayState(playState);
 }
@@ -441,7 +439,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     if (primitiveValue->getIdent() == CSSValueAll) {
         animation->setAnimationMode(CSSAnimationData::AnimateAll);
         animation->setProperty(CSSPropertyInvalid);
@@ -462,7 +460,7 @@
     }
 
     if (value->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         switch (primitiveValue->getIdent()) {
         case CSSValueLinear:
             animation->setTimingFunction(LinearTimingFunction::create());
@@ -506,7 +504,7 @@
         return;
 
     // Retrieve the border image value.
-    CSSValueList* borderImage = static_cast<CSSValueList*>(value);
+    CSSValueList* borderImage = toCSSValueList(value);
 
     // Set the image (this kicks off the load).
     CSSPropertyID imageProperty;
@@ -525,7 +523,7 @@
         else if (current->isBorderImageSliceValue())
             mapNinePieceImageSlice(current, image);
         else if (current->isValueList()) {
-            CSSValueList* slashList = static_cast<CSSValueList*>(current);
+            CSSValueList* slashList = toCSSValueList(current);
             // Map in the image slices.
             if (slashList->item(0) && slashList->item(0)->isBorderImageSliceValue())
                 mapNinePieceImageSlice(slashList->item(0), image);
@@ -600,7 +598,7 @@
     float zoom = useSVGZoomRules() ? 1.0f : style()->effectiveZoom();
 
     // Retrieve the primitive value.
-    CSSPrimitiveValue* borderWidths = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* borderWidths = toCSSPrimitiveValue(value);
 
     // Set up a length box to represent our image slices.
     LengthBox box; // Defaults to 'auto' so we don't have to handle that explicitly below.
@@ -641,7 +639,7 @@
     if (!value || !value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     Pair* pair = primitiveValue->getPairValue();
     if (!pair || !pair->first() || !pair->second())
         return;
diff --git a/Source/core/css/CSSValue.cpp b/Source/core/css/CSSValue.cpp
index 97967b9..d912e4e 100644
--- a/Source/core/css/CSSValue.cpp
+++ b/Source/core/css/CSSValue.cpp
@@ -119,9 +119,9 @@
     ASSERT(!isCSSOMSafe());
 
     if (isPrimitiveValue())
-        static_cast<const CSSPrimitiveValue*>(this)->addSubresourceStyleURLs(urls, styleSheet);
+        toCSSPrimitiveValue(this)->addSubresourceStyleURLs(urls, styleSheet);
     else if (isValueList())
-        static_cast<const CSSValueList*>(this)->addSubresourceStyleURLs(urls, styleSheet);
+        toCSSValueList(this)->addSubresourceStyleURLs(urls, styleSheet);
     else if (classType() == FontFaceSrcClass)
         static_cast<const CSSFontFaceSrcValue*>(this)->addSubresourceStyleURLs(urls, styleSheet);
     else if (classType() == ReflectClass)
@@ -134,11 +134,11 @@
     ASSERT(!isCSSOMSafe());
 
     if (isValueList())
-        return static_cast<const CSSValueList*>(this)->hasFailedOrCanceledSubresources();
+        return toCSSValueList(this)->hasFailedOrCanceledSubresources();
     if (classType() == FontFaceSrcClass)
         return static_cast<const CSSFontFaceSrcValue*>(this)->hasFailedOrCanceledSubresources();
     if (classType() == ImageClass)
-        return static_cast<const CSSImageValue*>(this)->hasFailedOrCanceledSubresources();
+        return toCSSImageValue(this)->hasFailedOrCanceledSubresources();
     if (classType() == CrossfadeClass)
         return static_cast<const CSSCrossfadeValue*>(this)->hasFailedOrCanceledSubresources();
     if (classType() == ImageSetClass)
@@ -158,10 +158,10 @@
     ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
     switch (classType()) {
     case PrimitiveClass:
-        static_cast<const CSSPrimitiveValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        toCSSPrimitiveValue(this)->reportDescendantMemoryUsage(memoryObjectInfo);
         return;
     case ImageClass:
-        static_cast<const CSSImageValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        toCSSImageValue(this)->reportDescendantMemoryUsage(memoryObjectInfo);
         return;
     case CursorImageClass:
         static_cast<const CSSCursorImageValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
@@ -250,7 +250,7 @@
         return;
 #endif
     case ValueListClass:
-        static_cast<const CSSValueList*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        toCSSValueList(this)->reportDescendantMemoryUsage(memoryObjectInfo);
         return;
     case ImageSetClass:
         static_cast<const CSSImageSetValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
@@ -355,7 +355,7 @@
             return false;
         }
     } else if (m_classType == ValueListClass && other.m_classType != ValueListClass)
-        return static_cast<const CSSValueList*>(this)->equals(other);
+        return toCSSValueList(this)->equals(other);
     else if (m_classType != ValueListClass && other.m_classType == ValueListClass)
         return static_cast<const CSSValueList&>(other).equals(*this);
     return false;
@@ -393,13 +393,13 @@
     case CrossfadeClass:
         return static_cast<const CSSCrossfadeValue*>(this)->customCssText();
     case ImageClass:
-        return static_cast<const CSSImageValue*>(this)->customCssText();
+        return toCSSImageValue(this)->customCssText();
     case InheritedClass:
         return static_cast<const CSSInheritedValue*>(this)->customCssText();
     case InitialClass:
         return static_cast<const CSSInitialValue*>(this)->customCssText();
     case PrimitiveClass:
-        return static_cast<const CSSPrimitiveValue*>(this)->customCssText();
+        return toCSSPrimitiveValue(this)->customCssText();
     case ReflectClass:
         return static_cast<const CSSReflectValue*>(this)->customCssText();
     case ShadowClass:
@@ -413,7 +413,7 @@
     case UnicodeRangeClass:
         return static_cast<const CSSUnicodeRangeValue*>(this)->customCssText();
     case ValueListClass:
-        return static_cast<const CSSValueList*>(this)->customCssText();
+        return toCSSValueList(this)->customCssText();
     case WebKitCSSTransformClass:
         return static_cast<const WebKitCSSTransformValue*>(this)->customCssText();
     case LineBoxContainClass:
@@ -449,11 +449,11 @@
 {
     switch (classType()) {
     case PrimitiveClass:
-        return static_cast<const CSSPrimitiveValue*>(this)->customSerializeResolvingVariables(variables);
+        return toCSSPrimitiveValue(this)->customSerializeResolvingVariables(variables);
     case ReflectClass:
         return static_cast<const CSSReflectValue*>(this)->customSerializeResolvingVariables(variables);
     case ValueListClass:
-        return static_cast<const CSSValueList*>(this)->customSerializeResolvingVariables(variables);
+        return toCSSValueList(this)->customSerializeResolvingVariables(variables);
     case WebKitCSSTransformClass:
         return static_cast<const WebKitCSSTransformValue*>(this)->customSerializeResolvingVariables(variables);
     default:
@@ -505,7 +505,7 @@
         delete static_cast<CSSCrossfadeValue*>(this);
         return;
     case ImageClass:
-        delete static_cast<CSSImageValue*>(this);
+        delete toCSSImageValue(this);
         return;
     case InheritedClass:
         delete static_cast<CSSInheritedValue*>(this);
@@ -514,7 +514,7 @@
         delete static_cast<CSSInitialValue*>(this);
         return;
     case PrimitiveClass:
-        delete static_cast<CSSPrimitiveValue*>(this);
+        delete toCSSPrimitiveValue(this);
         return;
     case ReflectClass:
         delete static_cast<CSSReflectValue*>(this);
@@ -535,7 +535,7 @@
         delete static_cast<CSSUnicodeRangeValue*>(this);
         return;
     case ValueListClass:
-        delete static_cast<CSSValueList*>(this);
+        delete toCSSValueList(this);
         return;
     case WebKitCSSTransformClass:
         delete static_cast<WebKitCSSTransformValue*>(this);
@@ -583,12 +583,12 @@
 {
     switch (classType()) {
     case PrimitiveClass:
-        return static_cast<const CSSPrimitiveValue*>(this)->cloneForCSSOM();
+        return toCSSPrimitiveValue(this)->cloneForCSSOM();
     case ValueListClass:
-        return static_cast<const CSSValueList*>(this)->cloneForCSSOM();
+        return toCSSValueList(this)->cloneForCSSOM();
     case ImageClass:
     case CursorImageClass:
-        return static_cast<const CSSImageValue*>(this)->cloneForCSSOM();
+        return toCSSImageValue(this)->cloneForCSSOM();
     case WebKitCSSFilterClass:
         return static_cast<const WebKitCSSFilterValue*>(this)->cloneForCSSOM();
     case WebKitCSSArrayFunctionValueClass:
diff --git a/Source/core/css/CSSValueList.h b/Source/core/css/CSSValueList.h
index 020f19c..7532e37 100644
--- a/Source/core/css/CSSValueList.h
+++ b/Source/core/css/CSSValueList.h
@@ -83,11 +83,26 @@
     Vector<RefPtr<CSSValue>, 4> m_values;
 };
 
+inline CSSValueList* toCSSValueList(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isValueList());
+    return static_cast<CSSValueList*>(value);
+}
+
+inline const CSSValueList* toCSSValueList(const CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isValueList());
+    return static_cast<const CSSValueList*>(value);
+}
+
+// Catch unneeded cast.
+void toCSSValueList(const CSSValueList*);
+
 // Objects of this class are intended to be stack-allocated and scoped to a single function.
 // Please take care not to pass these around as they do hold onto a raw pointer.
 class CSSValueListInspector {
 public:
-    CSSValueListInspector(CSSValue* value) : m_list((value && value->isValueList()) ? static_cast<CSSValueList*>(value) : 0) { }
+    CSSValueListInspector(CSSValue* value) : m_list((value && value->isValueList()) ? toCSSValueList(value) : 0) { }
     CSSValue* item(size_t index) const { ASSERT_WITH_SECURITY_IMPLICATION(index < length()); return m_list->itemWithoutBoundsCheck(index); }
     CSSValue* first() const { return item(0); }
     CSSValue* second() const { return item(1); }
@@ -111,6 +126,7 @@
     CSSValueListInspector m_inspector;
     size_t m_position;
 };
+
 } // namespace WebCore
 
 #endif // CSSValueList_h
diff --git a/Source/core/css/DeprecatedStyleBuilder.cpp b/Source/core/css/DeprecatedStyleBuilder.cpp
index 1344ae9..6b37bd2 100644
--- a/Source/core/css/DeprecatedStyleBuilder.cpp
+++ b/Source/core/css/DeprecatedStyleBuilder.cpp
@@ -144,7 +144,7 @@
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
         if (value->isPrimitiveValue())
-            setValue(styleResolver->style(), *static_cast<CSSPrimitiveValue*>(value));
+            setValue(styleResolver->style(), *toCSSPrimitiveValue(value));
     }
     static PropertyHandler createHandler()
     {
@@ -162,7 +162,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (primitiveValue->getIdent() == idMapsToMinusOne)
             setValue(styleResolver->style(), -1);
         else
@@ -210,7 +210,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (primitiveValue->getIdent() == autoIdentity)
             setAuto(styleResolver->style());
         else if (valueType == Number)
@@ -249,7 +249,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
         if (Rect* rect = primitiveValue->getRectValue()) {
             Length top = convertToLength(styleResolver, rect->top());
@@ -295,7 +295,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
             applyInheritValue(propertyID, styleResolver);
         else {
@@ -356,7 +356,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (noneEnabled && primitiveValue->getIdent() == CSSValueNone) {
             if (noneUndefined)
                 setValue(styleResolver->style(), Length(Undefined));
@@ -410,7 +410,7 @@
     {
         if (!value->isPrimitiveValue())
             return;
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSSValueNone)
             || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto))
             setValue(styleResolver->style(), nullAtom);
@@ -433,7 +433,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         Pair* pair = primitiveValue->getPairValue();
         if (!pair || !pair->first() || !pair->second())
             return;
@@ -538,7 +538,7 @@
         FillLayer* prevChild = 0;
         if (value->isValueList() && !value->isImageSetValue()) {
             /* Walk each value and put it into a layer, creating new layers as needed. */
-            CSSValueList* valueList = static_cast<CSSValueList*>(value);
+            CSSValueList* valueList = toCSSValueList(value);
             for (unsigned int i = 0; i < valueList->length(); i++) {
                 if (!currChild) {
                     /* Need to make a new layer to hold this value */
@@ -582,7 +582,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
         int ident = primitiveValue->getIdent();
         T length;
@@ -641,7 +641,7 @@
     {
         if (!value->isPrimitiveValue())
             return;
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         FontDescription fontDescription = styleResolver->fontDescription();
         (fontDescription.*setterFunction)(*primitiveValue);
         styleResolver->setFontDescription(fontDescription);
@@ -697,7 +697,7 @@
             CSSValue* item = i.value();
             if (!item->isPrimitiveValue())
                 continue;
-            CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(item);
+            CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
             AtomicString face;
             Settings* settings = styleResolver->document()->settings();
             if (contentValue->isString())
@@ -816,7 +816,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
         FontDescription fontDescription = styleResolver->style()->fontDescription();
         fontDescription.setKeywordSize(0);
@@ -890,7 +890,7 @@
     {
         if (!value->isPrimitiveValue())
             return;
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         FontDescription fontDescription = styleResolver->fontDescription();
         switch (primitiveValue->getIdent()) {
         case CSSValueInvalid:
@@ -946,12 +946,12 @@
         FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
 
         if (value->isValueList()) {
-            CSSValueList* valueList = static_cast<CSSValueList*>(value);
+            CSSValueList* valueList = toCSSValueList(value);
             for (size_t i = 0; i < valueList->length(); ++i) {
                 CSSValue* item = valueList->itemWithoutBoundsCheck(i);
                 ASSERT(item->isPrimitiveValue());
                 if (item->isPrimitiveValue()) {
-                    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
+                    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
                     switch (primitiveValue->getIdent()) {
                     case CSSValueNoCommonLigatures:
                         commonLigaturesState = FontDescription::DisabledLigaturesState;
@@ -981,7 +981,7 @@
 #if !ASSERT_DISABLED
         else {
             ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
-            ASSERT(static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueNormal);
+            ASSERT(toCSSPrimitiveValue(value)->getIdent() == CSSValueNormal);
         }
 #endif
 
@@ -1132,7 +1132,7 @@
         if (!value->isValueList())
             return;
 
-        CSSValueList* list = static_cast<CSSValueList*>(value);
+        CSSValueList* list = toCSSValueList(value);
 
         CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
         typedef CounterDirectiveMap::iterator Iterator;
@@ -1150,12 +1150,12 @@
             if (!currValue->isPrimitiveValue())
                 continue;
 
-            Pair* pair = static_cast<CSSPrimitiveValue*>(currValue)->getPairValue();
+            Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue();
             if (!pair || !pair->first() || !pair->second())
                 continue;
 
-            AtomicString identifier = static_cast<CSSPrimitiveValue*>(pair->first())->getStringValue();
-            int value = static_cast<CSSPrimitiveValue*>(pair->second())->getIntValue();
+            AtomicString identifier = pair->first()->getStringValue();
+            int value = pair->second()->getIntValue();
             CounterDirectives& directives = map.add(identifier, CounterDirectives()).iterator->value;
             if (counterBehavior == Reset) {
                 directives.setResetValue(value);
@@ -1186,7 +1186,7 @@
     {
         styleResolver->style()->clearCursorList();
         if (value->isValueList()) {
-            CSSValueList* list = static_cast<CSSValueList*>(value);
+            CSSValueList* list = toCSSValueList(value);
             int len = list->length();
             styleResolver->style()->setCursor(CURSOR_AUTO);
             for (int i = 0; i < len; i++) {
@@ -1197,13 +1197,13 @@
                         styleResolver->style()->setUnique();
                     styleResolver->style()->addCursor(styleResolver->styleImage(CSSPropertyCursor, image), image->hotSpot());
                 } else if (item->isPrimitiveValue()) {
-                    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
+                    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
                     if (primitiveValue->isIdent())
                         styleResolver->style()->setCursor(*primitiveValue);
                 }
             }
         } else if (value->isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
             if (primitiveValue->isIdent() && styleResolver->style()->cursor() != ECursor(*primitiveValue))
                 styleResolver->style()->setCursor(*primitiveValue);
         }
@@ -1219,7 +1219,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
         if (primitiveValue->getIdent() != CSSValueWebkitMatchParent)
             styleResolver->style()->setTextAlign(*primitiveValue);
@@ -1244,8 +1244,7 @@
         ETextDecoration t = RenderStyle::initialTextDecoration();
         for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
             CSSValue* item = i.value();
-            ASSERT_WITH_SECURITY_IMPLICATION(item->isPrimitiveValue());
-            t |= *static_cast<CSSPrimitiveValue*>(item);
+            t |= *toCSSPrimitiveValue(item);
         }
         styleResolver->style()->setTextDecoration(t);
     }
@@ -1263,7 +1262,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (primitiveValue->getIdent()) {
             switch (primitiveValue->getIdent()) {
             case CSSValueSmall:
@@ -1296,7 +1295,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (primitiveValue->getIdent() == CSSValueInfinite)
             styleResolver->style()->setMarqueeLoopCount(-1); // -1 means repeat forever.
         else if (primitiveValue->isNumber())
@@ -1316,7 +1315,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (int ident = primitiveValue->getIdent()) {
             switch (ident) {
             case CSSValueSlow:
@@ -1348,7 +1347,7 @@
     {
         // This is true if value is 'auto' or 'alphabetic'.
         if (value->isPrimitiveValue()) {
-            TextUnderlinePosition t = *static_cast<CSSPrimitiveValue*>(value);
+            TextUnderlinePosition t = *toCSSPrimitiveValue(value);
             styleResolver->style()->setTextUnderlinePosition(t);
             return;
         }
@@ -1356,8 +1355,7 @@
         unsigned t = 0;
         for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
             CSSValue* item = i.value();
-            ASSERT(item->isPrimitiveValue());
-            TextUnderlinePosition t2 = *static_cast<CSSPrimitiveValue*>(item);
+            TextUnderlinePosition t2 = *toCSSPrimitiveValue(item);
             t |= t2;
         }
         styleResolver->style()->setTextUnderlinePosition(static_cast<TextUnderlinePosition>(t));
@@ -1377,7 +1375,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         Length lineHeight;
 
         if (primitiveValue->getIdent() == CSSValueNormal)
@@ -1498,8 +1496,8 @@
             // <length>{2} | <page-size> <orientation>
             if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue())
                 return;
-            CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(inspector.first());
-            CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(inspector.second());
+            CSSPrimitiveValue* first = toCSSPrimitiveValue(inspector.first());
+            CSSPrimitiveValue* second = toCSSPrimitiveValue(inspector.second());
             if (first->isLength()) {
                 // <length>{2}
                 if (!second->isLength())
@@ -1519,7 +1517,7 @@
             // <length> | auto | <page-size> | [ portrait | landscape]
             if (!inspector.first()->isPrimitiveValue())
                 return;
-            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(inspector.first());
+            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.first());
             if (primitiveValue->isLength()) {
                 // <length>
                 pageSizeType = PAGE_SIZE_RESOLVED;
@@ -1574,7 +1572,7 @@
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
         if (value->isValueList()) {
-            CSSValueList* list = static_cast<CSSValueList*>(value);
+            CSSValueList* list = toCSSValueList(value);
             ASSERT(list->length() == 2);
             if (list->length() != 2)
                 return;
@@ -1583,7 +1581,7 @@
                 if (!item->isPrimitiveValue())
                     continue;
 
-                CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(item);
+                CSSPrimitiveValue* value = toCSSPrimitiveValue(item);
                 if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen)
                     styleResolver->style()->setTextEmphasisFill(*value);
                 else
@@ -1595,7 +1593,7 @@
 
         if (!value->isPrimitiveValue())
             return;
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
         if (primitiveValue->isString()) {
             styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
@@ -1724,7 +1722,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
         EResize r = RESIZE_NONE;
         switch (primitiveValue->getIdent()) {
@@ -1754,7 +1752,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
         if (primitiveValue->getIdent())
             return styleResolver->style()->setVerticalAlign(*primitiveValue);
@@ -1829,7 +1827,7 @@
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
         ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
         if (primitiveValue->getIdent() == CSSValueNormal) {
             resetEffectiveZoom(styleResolver);
@@ -1890,7 +1888,7 @@
         if (!value->isPrimitiveValue())
             return;
 
-        EDisplay display = *static_cast<CSSPrimitiveValue*>(value);
+        EDisplay display = *toCSSPrimitiveValue(value);
 
         if (!isValidDisplayValue(styleResolver, display))
             return;
@@ -1911,7 +1909,7 @@
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
         if (value->isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
             if (primitiveValue->getIdent() == CSSValueNone)
                 setValue(styleResolver->style(), 0);
             else if (primitiveValue->isShape()) {
@@ -1941,7 +1939,7 @@
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
         if (value->isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
             if (primitiveValue->getIdent() == CSSValueAuto)
                 setValue(styleResolver->style(), 0);
             // FIXME Bug 102571: Layout for the value 'outside-shape' is not yet implemented
@@ -1987,15 +1985,15 @@
         // The order is guaranteed. See CSSParser::parseTextIndent.
         // The second value, -webkit-each-line is handled only when CSS3_TEXT is enabled.
 
-        CSSValueList* valueList = static_cast<CSSValueList*>(value);
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valueList->itemWithoutBoundsCheck(0));
+        CSSValueList* valueList = toCSSValueList(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemWithoutBoundsCheck(0));
         Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
         ASSERT(!lengthOrPercentageValue.isUndefined());
         styleResolver->style()->setTextIndent(lengthOrPercentageValue);
 
 #if ENABLE(CSS3_TEXT)
         ASSERT(valueList->length() <= 2);
-        CSSPrimitiveValue* eachLineValue = static_cast<CSSPrimitiveValue*>(valueList->item(1));
+        CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1));
         if (eachLineValue) {
             ASSERT(eachLineValue->getIdent() == CSSValueWebkitEachLine);
             styleResolver->style()->setTextIndentLine(TextIndentEachLine);
diff --git a/Source/core/css/ElementRuleCollector.cpp b/Source/core/css/ElementRuleCollector.cpp
index 6766626..06b2156 100644
--- a/Source/core/css/ElementRuleCollector.cpp
+++ b/Source/core/css/ElementRuleCollector.cpp
@@ -286,6 +286,10 @@
     clearMatchedRules();
 
     m_mode = SelectorChecker::SharingRules;
+    // To check whether a given RuleSet has any rule matching a given element,
+    // should not see the element's treescope. Because RuleSet has no
+    // information about "scope".
+    m_behaviorAtBoundary = SelectorChecker::StaysWithinTreeScope;
     int firstRuleIndex = -1, lastRuleIndex = -1;
     StyleResolver::RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
     collectMatchingRules(MatchRequest(ruleSet), ruleRange);
diff --git a/Source/core/css/MediaFeatureNames.cpp b/Source/core/css/MediaFeatureNames.cpp
index c785958..9c1e92a 100644
--- a/Source/core/css/MediaFeatureNames.cpp
+++ b/Source/core/css/MediaFeatureNames.cpp
@@ -25,7 +25,8 @@
 #endif
 
 #include "core/css/MediaFeatureNames.h"
-#include <wtf/StaticConstructors.h>
+
+#include "wtf/StaticConstructors.h"
 
 namespace WebCore {
 namespace MediaFeatureNames {
@@ -39,7 +40,7 @@
 {
     static bool initialized;
     if (!initialized) {
-       // Use placement new to initialize the globals.
+        // Use placement new to initialize the globals.
 
         AtomicString::init();
 #define INITIALIZE_GLOBAL(name, str) new (NotNull, (void*)&name##MediaFeature) AtomicString(str, AtomicString::ConstructFromLiteral);
diff --git a/Source/core/css/MediaFeatureNames.h b/Source/core/css/MediaFeatureNames.h
index 3e3e9fe..78c8f19 100644
--- a/Source/core/css/MediaFeatureNames.h
+++ b/Source/core/css/MediaFeatureNames.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -20,63 +21,66 @@
 #ifndef MediaFeatureNames_h
 #define MediaFeatureNames_h
 
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
-    namespace MediaFeatureNames {
+namespace MediaFeatureNames {
 
 #define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \
     macro(color, "color") \
+    macro(colorIndex, "color-index") \
     macro(grid, "grid") \
     macro(monochrome, "monochrome") \
     macro(height, "height") \
     macro(hover, "hover") \
     macro(width, "width") \
     macro(orientation, "orientation") \
-    macro(aspect_ratio, "aspect-ratio") \
-    macro(device_aspect_ratio, "device-aspect-ratio") \
-    macro(device_pixel_ratio, "-webkit-device-pixel-ratio") \
-    macro(device_height, "device-height") \
-    macro(device_width, "device-width") \
-    macro(max_color, "max-color") \
-    macro(max_aspect_ratio, "max-aspect-ratio") \
-    macro(max_device_aspect_ratio, "max-device-aspect-ratio") \
-    macro(max_device_pixel_ratio, "-webkit-max-device-pixel-ratio") \
-    macro(max_device_height, "max-device-height") \
-    macro(max_device_width, "max-device-width") \
-    macro(max_height, "max-height") \
-    macro(max_monochrome, "max-monochrome") \
-    macro(max_width, "max-width") \
-    macro(max_resolution, "max-resolution") \
-    macro(min_color, "min-color") \
-    macro(min_aspect_ratio, "min-aspect-ratio") \
-    macro(min_device_aspect_ratio, "min-device-aspect-ratio") \
-    macro(min_device_pixel_ratio, "-webkit-min-device-pixel-ratio") \
-    macro(min_device_height, "min-device-height") \
-    macro(min_device_width, "min-device-width") \
-    macro(min_height, "min-height") \
-    macro(min_monochrome, "min-monochrome") \
-    macro(min_width, "min-width") \
-    macro(min_resolution, "min-resolution") \
+    macro(aspectRatio, "aspect-ratio") \
+    macro(deviceAspectRatio, "device-aspect-ratio") \
+    macro(devicePixelRatio, "-webkit-device-pixel-ratio") \
+    macro(deviceHeight, "device-height") \
+    macro(deviceWidth, "device-width") \
+    macro(maxColor, "max-color") \
+    macro(maxColorIndex, "max-color-index") \
+    macro(maxAspectRatio, "max-aspect-ratio") \
+    macro(maxDeviceAspectRatio, "max-device-aspect-ratio") \
+    macro(maxDevicePixelRatio, "-webkit-max-device-pixel-ratio") \
+    macro(maxDeviceHeight, "max-device-height") \
+    macro(maxDeviceWidth, "max-device-width") \
+    macro(maxHeight, "max-height") \
+    macro(maxMonochrome, "max-monochrome") \
+    macro(maxWidth, "max-width") \
+    macro(maxResolution, "max-resolution") \
+    macro(minColor, "min-color") \
+    macro(minColorIndex, "min-color-index") \
+    macro(minAspectRatio, "min-aspect-ratio") \
+    macro(minDeviceAspectRatio, "min-device-aspect-ratio") \
+    macro(minDevicePixelRatio, "-webkit-min-device-pixel-ratio") \
+    macro(minDeviceHeight, "min-device-height") \
+    macro(minDeviceWidth, "min-device-width") \
+    macro(minHeight, "min-height") \
+    macro(minMonochrome, "min-monochrome") \
+    macro(minWidth, "min-width") \
+    macro(minResolution, "min-resolution") \
     macro(pointer, "pointer") \
     macro(resolution, "resolution") \
-    macro(transform_2d, "-webkit-transform-2d") \
-    macro(transform_3d, "-webkit-transform-3d") \
+    macro(transform2d, "-webkit-transform-2d") \
+    macro(transform3d, "-webkit-transform-3d") \
     macro(transition, "-webkit-transition") \
     macro(animation, "-webkit-animation") \
-    macro(view_mode, "-webkit-view-mode")
+    macro(viewMode, "-webkit-view-mode")
 
 // end of macro
 
 #ifndef CSS_MEDIAQUERY_NAMES_HIDE_GLOBALS
-    #define CSS_MEDIAQUERY_NAMES_DECLARE(name, str) extern const AtomicString name##MediaFeature;
-    CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(CSS_MEDIAQUERY_NAMES_DECLARE)
-    #undef CSS_MEDIAQUERY_NAMES_DECLARE
+#define CSS_MEDIAQUERY_NAMES_DECLARE(name, str) extern const AtomicString name##MediaFeature;
+CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(CSS_MEDIAQUERY_NAMES_DECLARE)
+#undef CSS_MEDIAQUERY_NAMES_DECLARE
 #endif
 
-        void init();
+    void init();
 
-    } // namespace MediaFeatureNames
+} // namespace MediaFeatureNames
 } // namespace WebCore
 
 #endif // MediaFeatureNames_h
diff --git a/Source/core/css/MediaList.cpp b/Source/core/css/MediaList.cpp
index 0b631c5..ebaa05b 100644
--- a/Source/core/css/MediaList.cpp
+++ b/Source/core/css/MediaList.cpp
@@ -32,8 +32,8 @@
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/page/Console.h"
 #include "core/page/DOMWindow.h"
-#include <wtf/MemoryInstrumentationVector.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/MemoryInstrumentationVector.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -64,7 +64,7 @@
  * document.styleSheets[0].cssRules[0].media.mediaText = "screen and resolution > 40dpi" will
  * throw SYNTAX_ERR exception.
  */
-    
+
 MediaQuerySet::MediaQuerySet()
     : m_fallbackToDescriptor(false)
     , m_lastLine(0)
@@ -84,7 +84,7 @@
     // for both html and svg, even though svg:style doesn't use media descriptors
     // Currently the only places where parsing can fail are
     // creating <svg:style>, creating css media / import rules from js
-    
+
     // FIXME: This doesn't make much sense.
     if (!success)
         parse("invalid");
@@ -114,10 +114,7 @@
     unsigned i = 0;
     for (; i < length; ++i) {
         unsigned short c = string[i];
-        if (! ((c >= 'a' && c <= 'z')
-               || (c >= 'A' && c <= 'Z')
-               || (c >= '1' && c <= '9')
-               || (c == '-')))
+        if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '1' && c <= '9') || (c == '-')))
             break;
     }
     return string.left(i);
@@ -126,7 +123,7 @@
 bool MediaQuerySet::parse(const String& mediaString)
 {
     CSSParser parser(CSSStrictMode);
-    
+
     Vector<OwnPtr<MediaQuery> > result;
     Vector<String> list;
     mediaString.split(',', list);
@@ -187,7 +184,7 @@
     }
     if (!parsedQuery)
         return false;
-    
+
     for (size_t i = 0; i < m_queries.size(); ++i) {
         MediaQuery* query = m_queries[i].get();
         if (*query == *parsedQuery) {
@@ -206,7 +203,7 @@
 String MediaQuerySet::mediaText() const
 {
     StringBuilder text;
-    
+
     bool first = true;
     for (size_t i = 0; i < m_queries.size(); ++i) {
         if (!first)
@@ -223,7 +220,7 @@
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addMember(m_queries, "queries");
 }
-    
+
 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSStyleSheet* parentSheet)
     : m_mediaQueries(mediaQueries)
     , m_parentStyleSheet(parentSheet)
@@ -304,7 +301,6 @@
     info.addMember(m_parentRule, "parentRule");
 }
 
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
 static void addResolutionWarningMessageToConsole(Document* document, const String& serializedExpression, const CSSPrimitiveValue* value)
 {
     ASSERT(document);
@@ -329,6 +325,13 @@
     document->addConsoleMessage(CSSMessageSource, DebugMessageLevel, message);
 }
 
+static inline bool isResolutionMediaFeature(const AtomicString& mediaFeature)
+{
+    return mediaFeature == MediaFeatureNames::resolutionMediaFeature
+        || mediaFeature == MediaFeatureNames::maxResolutionMediaFeature
+        || mediaFeature == MediaFeatureNames::minResolutionMediaFeature;
+}
+
 void reportMediaQueryWarningIfNeeded(Document* document, const MediaQuerySet* mediaQuerySet)
 {
     if (!mediaQuerySet || !document)
@@ -342,23 +345,22 @@
 
     for (size_t i = 0; i < queryCount; ++i) {
         const MediaQuery* query = mediaQueries[i].get();
-        String mediaType = query->mediaType();
-        if (!query->ignored() && !equalIgnoringCase(mediaType, "print")) {
-            const Vector<OwnPtr<MediaQueryExp> >* exps = query->expressions();
-            for (size_t j = 0; j < exps->size(); ++j) {
-                const MediaQueryExp* exp = exps->at(j).get();
-                if (exp->mediaFeature() == MediaFeatureNames::resolutionMediaFeature || exp->mediaFeature() == MediaFeatureNames::max_resolutionMediaFeature || exp->mediaFeature() == MediaFeatureNames::min_resolutionMediaFeature) {
-                    CSSValue* cssValue =  exp->value();
-                    if (cssValue && cssValue->isPrimitiveValue()) {
-                        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(cssValue);
-                        if (primitiveValue->isDotsPerInch() || primitiveValue->isDotsPerCentimeter())
-                            addResolutionWarningMessageToConsole(document, mediaQuerySet->mediaText(), primitiveValue);
-                    }
+        if (query->ignored() || equalIgnoringCase(query->mediaType(), "print"))
+            continue;
+
+        const Vector<OwnPtr<MediaQueryExp> >* exps = query->expressions();
+        for (size_t j = 0; j < exps->size(); ++j) {
+            const MediaQueryExp* exp = exps->at(j).get();
+            if (isResolutionMediaFeature(exp->mediaFeature())) {
+                CSSValue* cssValue =  exp->value();
+                if (cssValue && cssValue->isPrimitiveValue()) {
+                    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(cssValue);
+                    if (primitiveValue->isDotsPerInch() || primitiveValue->isDotsPerCentimeter())
+                        addResolutionWarningMessageToConsole(document, mediaQuerySet->mediaText(), primitiveValue);
                 }
             }
         }
     }
 }
-#endif
 
 }
diff --git a/Source/core/css/MediaList.h b/Source/core/css/MediaList.h
index e1bf0b8..93f8c1d 100644
--- a/Source/core/css/MediaList.h
+++ b/Source/core/css/MediaList.h
@@ -22,11 +22,11 @@
 #define MediaList_h
 
 #include "core/dom/ExceptionCode.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -51,7 +51,7 @@
         return adoptRef(new MediaQuerySet(mediaString, true));
     }
     ~MediaQuerySet();
-    
+
     bool parse(const String&);
     bool add(const String&);
     bool remove(const String&);
@@ -59,10 +59,10 @@
     void addMediaQuery(PassOwnPtr<MediaQuery>);
 
     const Vector<OwnPtr<MediaQuery> >& queryVector() const { return m_queries; }
-    
+
     int lastLine() const { return m_lastLine; }
     void setLastLine(int lastLine) { m_lastLine = lastLine; }
-    
+
     String mediaText() const;
 
     PassRefPtr<MediaQuerySet> copy() const { return adoptRef(new MediaQuerySet(*this)); }
@@ -73,7 +73,7 @@
     MediaQuerySet();
     MediaQuerySet(const String& mediaQuery, bool fallbackToDescription);
     MediaQuerySet(const MediaQuerySet&);
-    
+
     unsigned m_fallbackToDescriptor : 1; // true if failed media query parsing should fallback to media description parsing.
     signed m_lastLine : 31;
     Vector<OwnPtr<MediaQuery> > m_queries;
@@ -121,10 +121,8 @@
     CSSRule* m_parentRule;
 };
 
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
 // Adds message to inspector console whenever dpi or dpcm values are used for "screen" media.
 void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*);
-#endif
 
 } // namespace
 
diff --git a/Source/core/css/MediaQuery.cpp b/Source/core/css/MediaQuery.cpp
index 1a2ffc0..f5a322a 100644
--- a/Source/core/css/MediaQuery.cpp
+++ b/Source/core/css/MediaQuery.cpp
@@ -31,9 +31,9 @@
 
 #include "core/css/MediaQueryExp.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/MemoryInstrumentationVector.h>
-#include <wtf/NonCopyingSort.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/MemoryInstrumentationVector.h"
+#include "wtf/NonCopyingSort.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -147,4 +147,4 @@
     info.addMember(m_serializationCache, "serializationCache");
 }
 
-} //namespace
+}
diff --git a/Source/core/css/MediaQuery.h b/Source/core/css/MediaQuery.h
index 09ca940..13653a0 100644
--- a/Source/core/css/MediaQuery.h
+++ b/Source/core/css/MediaQuery.h
@@ -29,10 +29,10 @@
 #ifndef MediaQuery_h
 #define MediaQuery_h
 
-#include <wtf/PassOwnPtr.h>
-#include <wtf/Vector.h>
-#include <wtf/text/StringHash.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/StringHash.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 class MediaQueryExp;
@@ -60,7 +60,7 @@
 
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
- private:
+private:
     MediaQuery(const MediaQuery&);
 
     Restrictor m_restrictor;
diff --git a/Source/core/css/MediaQueryEvaluator.cpp b/Source/core/css/MediaQueryEvaluator.cpp
index 59d1e85..d1aa3f7 100644
--- a/Source/core/css/MediaQueryEvaluator.cpp
+++ b/Source/core/css/MediaQueryEvaluator.cpp
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
  * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,6 +32,7 @@
 
 #include "CSSValueKeywords.h"
 #include "core/css/CSSAspectRatioValue.h"
+#include "core/css/CSSHelper.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSValueList.h"
 #include "core/css/MediaFeatureNames.h"
@@ -53,7 +55,7 @@
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/style/RenderStyle.h"
-#include <wtf/HashMap.h>
+#include "wtf/HashMap.h"
 
 namespace WebCore {
 
@@ -66,10 +68,8 @@
 static FunctionMap* gFunctionMap;
 
 /*
- * FIXME: following media features are not implemented: color_index, scan
+ * FIXME: following media features are not implemented:  scan
  *
- * color_index, min-color-index, max_color_index: It's unknown how to retrieve
- * the information if the display mode is indexed
  * scan: The "scan" media feature describes the scanning process of
  * tv output devices. It's unknown how to retrieve this information from
  * the platform
@@ -195,28 +195,11 @@
     return false;
 }
 
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
-static bool compareResolution(float min, float max, float value, MediaFeaturePrefix op)
-{
-    switch (op) {
-    case NoPrefix:
-        // A 'resolution' (without a "min-" or "max-" prefix) query
-        // never matches a device with non-square pixels.
-        return value == min && value == max;
-    case MinPrefix:
-        return min >= value;
-    case MaxPrefix:
-        return max <= value;
-    }
-    return false;
-}
-#endif
-
 static bool numberValue(CSSValue* value, float& result)
 {
     if (value->isPrimitiveValue()
-        && static_cast<CSSPrimitiveValue*>(value)->isNumber()) {
-        result = static_cast<CSSPrimitiveValue*>(value)->getFloatValue(CSSPrimitiveValue::CSS_NUMBER);
+        && toCSSPrimitiveValue(value)->isNumber()) {
+        result = toCSSPrimitiveValue(value)->getFloatValue(CSSPrimitiveValue::CSS_NUMBER);
         return true;
     }
     return false;
@@ -232,6 +215,17 @@
     return bitsPerComponent != 0;
 }
 
+static bool colorIndexMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFeaturePrefix op)
+{
+    // FIXME: We currently assume that we do not support indexed displays, as it is unknown
+    // how to retrieve the information if the display mode is indexed. This matches Firefox.
+    if (!value)
+        return false;
+
+    float number;
+    return numberValue(value, number) && compareValue(0, static_cast<int>(number), op);
+}
+
 static bool monochromeMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (!screenIsMonochrome(frame->page()->mainFrame()->view())) {
@@ -256,7 +250,7 @@
     int width = viewportSize(view).width();
     int height = viewportSize(view).height();
     if (value && value->isPrimitiveValue()) {
-        const int id = static_cast<CSSPrimitiveValue*>(value)->getIdent();
+        const int id = toCSSPrimitiveValue(value)->getIdent();
         if (width > height) // Square viewport is portrait.
             return CSSValueLandscape == id;
         return CSSValuePortrait == id;
@@ -266,7 +260,7 @@
     return height >= 0 && width >= 0;
 }
 
-static bool aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
+static bool aspectRatioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
         FrameView* view = frame->view();
@@ -278,7 +272,7 @@
     return true;
 }
 
-static bool device_aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
+static bool deviceAspectRatioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
         FloatRect sg = screenRect(frame->page()->mainFrame()->view());
@@ -290,7 +284,7 @@
     return true;
 }
 
-static bool device_pixel_ratioMediaFeatureEval(CSSValue *value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
+static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op)
 {
     // FIXME: Possible handle other media types than 'screen' and 'print'.
     float deviceScaleFactor = 0;
@@ -303,117 +297,48 @@
     if (equalIgnoringCase(mediaType, "screen"))
         deviceScaleFactor = frame->page()->deviceScaleFactor();
     else if (equalIgnoringCase(mediaType, "print")) {
-        // The resolution of images while printing should not depend on the dpi
+        // The resolution of images while printing should not depend on the DPI
         // of the screen. Until we support proper ways of querying this info
         // we use 300px which is considered minimum for current printers.
-        deviceScaleFactor = 3.125; // 300dpi / 96dpi;
+        deviceScaleFactor = 300 / cssPixelsPerInch;
     }
 
     if (!value)
         return !!deviceScaleFactor;
 
-    return value->isPrimitiveValue() && compareValue(deviceScaleFactor, static_cast<CSSPrimitiveValue*>(value)->getFloatValue(), op);
+    if (!value->isPrimitiveValue())
+        return false;
+
+    CSSPrimitiveValue* resolution = toCSSPrimitiveValue(value);
+
+    if (resolution->isNumber())
+        return compareValue(deviceScaleFactor, resolution->getFloatValue(), op);
+
+    if (!resolution->isResolution())
+        return false;
+
+    if (resolution->isDotsPerCentimeter()) {
+        // To match DPCM to DPPX values, we limit to 2 decimal points.
+        // The http://dev.w3.org/csswg/css3-values/#absolute-lengths recommends
+        // "that the pixel unit refer to the whole number of device pixels that best
+        // approximates the reference pixel". With that in mind, allowing 2 decimal
+        // point precision seems appropriate.
+        return compareValue(
+            floorf(0.5 + 100 * deviceScaleFactor) / 100,
+            floorf(0.5 + 100 * resolution->getFloatValue(CSSPrimitiveValue::CSS_DPPX)) / 100, op);
+    }
+
+    return compareValue(deviceScaleFactor, resolution->getFloatValue(CSSPrimitiveValue::CSS_DPPX), op);
+}
+
+static bool devicePixelRatioMediaFeatureEval(CSSValue *value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
+{
+    return (!value || toCSSPrimitiveValue(value)->isNumber()) && evalResolution(value, frame, op);
 }
 
 static bool resolutionMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
-    // The DPI below is dots per CSS inch and thus not device inch. The
-    // functions should respect this.
-    //
-    // For square pixels, it is simply the device scale factor (dppx) times 96,
-    // per definition.
-    //
-    // The device scale factor is a predefined value which is calculated per
-    // device given the preferred distance in arms length (considered one arms
-    // length for desktop computers and usually 0.6 arms length for phones).
-    //
-    // The value can be calculated as follows (rounded to quarters):
-    //     round((deviceDotsPerInch * distanceInArmsLength / 96) * 4) / 4.
-    // Example (mid-range resolution phone):
-    //     round((244 * 0.6 / 96) * 4) / 4 = 1.5
-    // Example (high-range resolution laptop):
-    //     round((220 * 1.0 / 96) * 4) / 4 = 2.0
-
-    float horiDPI;
-    float vertDPI;
-
-    // This checks the actual media type applied to the document, and we know
-    // this method only got called if this media type matches the one defined
-    // in the query. Thus, if if the document's media type is "print", the
-    // media type of the query will either be "print" or "all".
-    String mediaType = frame->view()->mediaType();
-    if (equalIgnoringCase(mediaType, "screen")) {
-        Screen* screen = frame->document()->domWindow()->screen();
-        horiDPI = screen->horizontalDPI();
-        vertDPI = screen->verticalDPI();
-    } else if (equalIgnoringCase(mediaType, "print")) {
-        // The resolution of images while printing should not depend on the dpi
-        // of the screen. Until we support proper ways of querying this info
-        // we use 300px which is considered minimum for current printers.
-        horiDPI = vertDPI = 300;
-    } else {
-        // FIXME: Possible handle other media types than 'screen' and 'print'.
-        // For now, do not match.
-        return false;
-    }
-
-    float leastDenseDPI = std::min(horiDPI, vertDPI);
-    float mostDenseDPI = std::max(horiDPI, vertDPI);
-
-    // According to spec, (resolution) will evaluate to true if (resolution:x)
-    // will evaluate to true for a value x other than zero or zero followed by
-    // a valid unit identifier (i.e., other than 0, 0dpi, 0dpcm, or 0dppx.),
-    // which is always the case. But the spec special cases 'resolution' to
-    // never matches a device with non-square pixels.
-    if (!value) {
-        ASSERT(op == NoPrefix);
-        return leastDenseDPI == mostDenseDPI;
-    }
-
-    if (!value->isPrimitiveValue())
-        return false;
-
-    // http://dev.w3.org/csswg/css3-values/#resolution defines resolution as a
-    // dimension, which contains a number (decimal point allowed), not just an
-    // integer. Also, http://dev.w3.org/csswg/css3-values/#numeric-types says
-    // "CSS theoretically supports infinite precision and infinite ranges for
-    // all value types;
-    CSSPrimitiveValue* rawValue = static_cast<CSSPrimitiveValue*>(value);
-
-    if (rawValue->isDotsPerPixel()) {
-        // http://dev.w3.org/csswg/css3-values/#absolute-lengths recommends
-        // "that the pixel unit refer to the whole number of device pixels that
-        // best approximates the reference pixel". We compare with 3 decimal
-        // points, which aligns with current device-pixel-ratio's in use.
-        float leastDenseDensity = floorf(leastDenseDPI * 1000 / 96) / 1000;
-        float mostDenseDensity = floorf(leastDenseDPI * 1000 / 96) / 1000;
-        float testedDensity = rawValue->getFloatValue(CSSPrimitiveValue::CSS_DPPX);
-        return compareResolution(leastDenseDensity, mostDenseDensity, testedDensity, op);
-    }
-
-    if (rawValue->isDotsPerInch()) {
-        unsigned testedDensity = rawValue->getFloatValue(CSSPrimitiveValue::CSS_DPI);
-        return compareResolution(leastDenseDPI, mostDenseDPI, testedDensity, op);
-    }
-
-    // http://dev.w3.org/csswg/css3-values/#absolute-lengths recommends "that
-    // the pixel unit refer to the whole number of device pixels that best
-    // approximates the reference pixel".
-    float leastDenseDPCM = roundf(leastDenseDPI / 2.54); // (2.54 cm/in)
-    float mostDenseDPCM = roundf(mostDenseDPI / 2.54);
-
-    if (rawValue->isDotsPerCentimeter()) {
-        float testedDensity = rawValue->getFloatValue(CSSPrimitiveValue::CSS_DPCM);
-        return compareResolution(leastDenseDPCM, mostDenseDPCM, testedDensity, op);
-    }
-#else
-    UNUSED_PARAM(value);
-    UNUSED_PARAM(frame);
-    UNUSED_PARAM(op);
-#endif
-
-    return false;
+    return (!value || toCSSPrimitiveValue(value)->isResolution()) && evalResolution(value, frame, op);
 }
 
 static bool gridMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFeaturePrefix op)
@@ -431,7 +356,7 @@
     if (!value->isPrimitiveValue())
         return false;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
     if (primitiveValue->isNumber()) {
         result = primitiveValue->getIntValue();
@@ -446,7 +371,7 @@
     return false;
 }
 
-static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
+static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
         FloatRect sg = screenRect(frame->page()->mainFrame()->view());
@@ -461,7 +386,7 @@
     return true;
 }
 
-static bool device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
+static bool deviceWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
         FloatRect sg = screenRect(frame->page()->mainFrame()->view());
@@ -510,102 +435,112 @@
 
 // rest of the functions are trampolines which set the prefix according to the media feature expression used
 
-static bool min_colorMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minColorMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return colorMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_colorMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxColorMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return colorMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_monochromeMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minColorIndexMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+{
+    return colorIndexMediaFeatureEval(value, style, frame, MinPrefix);
+}
+
+static bool maxColorIndexMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+{
+    return colorIndexMediaFeatureEval(value, style, frame, MaxPrefix);
+}
+
+static bool minMonochromeMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return monochromeMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_monochromeMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxMonochromeMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return monochromeMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minAspectRatioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return aspect_ratioMediaFeatureEval(value, style, frame, MinPrefix);
+    return aspectRatioMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxAspectRatioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return aspect_ratioMediaFeatureEval(value, style, frame, MaxPrefix);
+    return aspectRatioMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_device_aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minDeviceAspectRatioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return device_aspect_ratioMediaFeatureEval(value, style, frame, MinPrefix);
+    return deviceAspectRatioMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_device_aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxDeviceAspectRatioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return device_aspect_ratioMediaFeatureEval(value, style, frame, MaxPrefix);
+    return deviceAspectRatioMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_device_pixel_ratioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minDevicePixelRatioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return device_pixel_ratioMediaFeatureEval(value, style, frame, MinPrefix);
+    return devicePixelRatioMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_device_pixel_ratioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxDevicePixelRatioMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return device_pixel_ratioMediaFeatureEval(value, style, frame, MaxPrefix);
+    return devicePixelRatioMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return heightMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return heightMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return widthMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return widthMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minDeviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return device_heightMediaFeatureEval(value, style, frame, MinPrefix);
+    return deviceHeightMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxDeviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return device_heightMediaFeatureEval(value, style, frame, MaxPrefix);
+    return deviceHeightMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minDeviceWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return device_widthMediaFeatureEval(value, style, frame, MinPrefix);
+    return deviceWidthMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxDeviceWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
-    return device_widthMediaFeatureEval(value, style, frame, MaxPrefix);
+    return deviceWidthMediaFeatureEval(value, style, frame, MaxPrefix);
 }
 
-static bool min_resolutionMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool minResolutionMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return resolutionMediaFeatureEval(value, style, frame, MinPrefix);
 }
 
-static bool max_resolutionMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
+static bool maxResolutionMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix)
 {
     return resolutionMediaFeatureEval(value, style, frame, MaxPrefix);
 }
@@ -628,7 +563,7 @@
     return true;
 }
 
-static bool transform_2dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFeaturePrefix op)
+static bool transform2dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFeaturePrefix op)
 {
     if (value) {
         float number;
@@ -637,7 +572,7 @@
     return true;
 }
 
-static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
+static bool transform3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
     bool returnValueIfNoParameter;
     int have3dRendering;
@@ -656,13 +591,13 @@
     return returnValueIfNoParameter;
 }
 
-static bool view_modeMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
+static bool viewModeMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
     UNUSED_PARAM(op);
     if (!value)
         return true;
 
-    return static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueWindowed;
+    return toCSSPrimitiveValue(value)->getIdent() == CSSValueWindowed;
 }
 
 enum PointerDeviceType { TouchPointer, MousePointer, NoPointer, UnknownPointer };
@@ -719,7 +654,7 @@
     if (!value->isPrimitiveValue())
         return false;
 
-    const int id = static_cast<CSSPrimitiveValue*>(value)->getIdent();
+    const int id = toCSSPrimitiveValue(value)->getIdent();
     return (pointer == NoPointer && id == CSSValueNone)
         || (pointer == TouchPointer && id == CSSValueCoarse)
         || (pointer == MousePointer && id == CSSValueFine);
diff --git a/Source/core/css/MediaQueryEvaluator.h b/Source/core/css/MediaQueryEvaluator.h
index 16619ca..dec0c86 100644
--- a/Source/core/css/MediaQueryEvaluator.h
+++ b/Source/core/css/MediaQueryEvaluator.h
@@ -28,7 +28,7 @@
 #ifndef MediaQueryEvaluator_h
 #define MediaQueryEvaluator_h
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 class Frame;
@@ -50,7 +50,7 @@
  * of stylesheets to only those which are probable to match.
  */
 class MediaQueryEvaluator {
-     WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); WTF_MAKE_FAST_ALLOCATED;
 public:
     /** Creates evaluator which evaluates only simple media queries
      *  Evaluator returns true for "all", and returns value of \mediaFeatureResult
@@ -65,8 +65,7 @@
     MediaQueryEvaluator(const String& acceptedMediaType, bool mediaFeatureResult = false);
     MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult = false);
 
-    /** Creates evaluator which evaluates full media queries
-     */
+    /** Creates evaluator which evaluates full media queries */
     MediaQueryEvaluator(const String& acceptedMediaType, Frame*, RenderStyle*);
 
     ~MediaQueryEvaluator();
@@ -82,7 +81,7 @@
 
 private:
     String m_mediaType;
-    Frame* m_frame; // not owned
+    Frame* m_frame; // Not owned.
     RefPtr<RenderStyle> m_style;
     bool m_expResult;
 };
diff --git a/Source/core/css/MediaQueryExp.cpp b/Source/core/css/MediaQueryExp.cpp
index 711ee9d..fdfe564 100644
--- a/Source/core/css/MediaQueryExp.cpp
+++ b/Source/core/css/MediaQueryExp.cpp
@@ -35,7 +35,7 @@
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSValueList.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -45,7 +45,7 @@
         return false;
 
     return mediaFeature == MediaFeatureNames::orientationMediaFeature
-        || mediaFeature == MediaFeatureNames::view_modeMediaFeature
+        || mediaFeature == MediaFeatureNames::viewModeMediaFeature
         || mediaFeature == MediaFeatureNames::pointerMediaFeature;
 }
 
@@ -55,17 +55,17 @@
         return false;
 
     return mediaFeature == MediaFeatureNames::heightMediaFeature
-        || mediaFeature == MediaFeatureNames::max_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::min_heightMediaFeature
+        || mediaFeature == MediaFeatureNames::maxHeightMediaFeature
+        || mediaFeature == MediaFeatureNames::minHeightMediaFeature
         || mediaFeature == MediaFeatureNames::widthMediaFeature
-        || mediaFeature == MediaFeatureNames::max_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::min_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::device_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::max_device_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::min_device_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::device_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::max_device_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::min_device_widthMediaFeature;
+        || mediaFeature == MediaFeatureNames::maxWidthMediaFeature
+        || mediaFeature == MediaFeatureNames::minWidthMediaFeature
+        || mediaFeature == MediaFeatureNames::deviceHeightMediaFeature
+        || mediaFeature == MediaFeatureNames::maxDeviceHeightMediaFeature
+        || mediaFeature == MediaFeatureNames::minDeviceHeightMediaFeature
+        || mediaFeature == MediaFeatureNames::deviceWidthMediaFeature
+        || mediaFeature == MediaFeatureNames::maxDeviceWidthMediaFeature
+        || mediaFeature == MediaFeatureNames::minDeviceWidthMediaFeature;
 }
 
 static inline bool featureWithValidDensity(const AtomicString& mediaFeature, const CSSParserValue* value)
@@ -74,8 +74,8 @@
         return false;
 
     return mediaFeature == MediaFeatureNames::resolutionMediaFeature
-        || mediaFeature == MediaFeatureNames::max_resolutionMediaFeature
-        || mediaFeature == MediaFeatureNames::min_resolutionMediaFeature;
+        || mediaFeature == MediaFeatureNames::maxResolutionMediaFeature
+        || mediaFeature == MediaFeatureNames::minResolutionMediaFeature;
 }
 
 static inline bool featureWithPositiveInteger(const AtomicString& mediaFeature, const CSSParserValue* value)
@@ -84,10 +84,13 @@
         return false;
 
     return mediaFeature == MediaFeatureNames::colorMediaFeature
-        || mediaFeature == MediaFeatureNames::max_colorMediaFeature
-        || mediaFeature == MediaFeatureNames::min_colorMediaFeature
-        || mediaFeature == MediaFeatureNames::min_monochromeMediaFeature
-        || mediaFeature == MediaFeatureNames::max_monochromeMediaFeature;
+        || mediaFeature == MediaFeatureNames::maxColorMediaFeature
+        || mediaFeature == MediaFeatureNames::minColorMediaFeature
+        || mediaFeature == MediaFeatureNames::colorIndexMediaFeature
+        || mediaFeature == MediaFeatureNames::maxColorIndexMediaFeature
+        || mediaFeature == MediaFeatureNames::minColorIndexMediaFeature
+        || mediaFeature == MediaFeatureNames::minMonochromeMediaFeature
+        || mediaFeature == MediaFeatureNames::maxMonochromeMediaFeature;
 }
 
 static inline bool featureWithPositiveNumber(const AtomicString& mediaFeature, const CSSParserValue* value)
@@ -95,13 +98,13 @@
     if (value->unit != CSSPrimitiveValue::CSS_NUMBER || value->fValue < 0)
         return false;
 
-    return mediaFeature == MediaFeatureNames::transform_2dMediaFeature
-        || mediaFeature == MediaFeatureNames::transform_3dMediaFeature
+    return mediaFeature == MediaFeatureNames::transform2dMediaFeature
+        || mediaFeature == MediaFeatureNames::transform3dMediaFeature
         || mediaFeature == MediaFeatureNames::transitionMediaFeature
         || mediaFeature == MediaFeatureNames::animationMediaFeature
-        || mediaFeature == MediaFeatureNames::device_pixel_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::max_device_pixel_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::min_device_pixel_ratioMediaFeature;
+        || mediaFeature == MediaFeatureNames::devicePixelRatioMediaFeature
+        || mediaFeature == MediaFeatureNames::maxDevicePixelRatioMediaFeature
+        || mediaFeature == MediaFeatureNames::minDevicePixelRatioMediaFeature;
 }
 
 static inline bool featureWithZeroOrOne(const AtomicString& mediaFeature, const CSSParserValue* value)
@@ -115,12 +118,12 @@
 
 static inline bool featureWithAspectRatio(const AtomicString& mediaFeature)
 {
-    return mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::device_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::min_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::max_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::min_device_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::max_device_aspect_ratioMediaFeature;
+    return mediaFeature == MediaFeatureNames::aspectRatioMediaFeature
+        || mediaFeature == MediaFeatureNames::deviceAspectRatioMediaFeature
+        || mediaFeature == MediaFeatureNames::minAspectRatioMediaFeature
+        || mediaFeature == MediaFeatureNames::maxAspectRatioMediaFeature
+        || mediaFeature == MediaFeatureNames::minDeviceAspectRatioMediaFeature
+        || mediaFeature == MediaFeatureNames::maxDeviceAspectRatioMediaFeature;
 }
 
 static inline bool featureWithoutValue(const AtomicString& mediaFeature)
@@ -128,25 +131,40 @@
     // Media features that are prefixed by min/max cannot be used without a value.
     return mediaFeature == MediaFeatureNames::monochromeMediaFeature
         || mediaFeature == MediaFeatureNames::colorMediaFeature
+        || mediaFeature == MediaFeatureNames::colorIndexMediaFeature
         || mediaFeature == MediaFeatureNames::gridMediaFeature
         || mediaFeature == MediaFeatureNames::heightMediaFeature
         || mediaFeature == MediaFeatureNames::widthMediaFeature
-        || mediaFeature == MediaFeatureNames::device_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::device_widthMediaFeature
+        || mediaFeature == MediaFeatureNames::deviceHeightMediaFeature
+        || mediaFeature == MediaFeatureNames::deviceWidthMediaFeature
         || mediaFeature == MediaFeatureNames::orientationMediaFeature
-        || mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::device_aspect_ratioMediaFeature
+        || mediaFeature == MediaFeatureNames::aspectRatioMediaFeature
+        || mediaFeature == MediaFeatureNames::deviceAspectRatioMediaFeature
         || mediaFeature == MediaFeatureNames::hoverMediaFeature
-        || mediaFeature == MediaFeatureNames::transform_2dMediaFeature
-        || mediaFeature == MediaFeatureNames::transform_3dMediaFeature
+        || mediaFeature == MediaFeatureNames::transform2dMediaFeature
+        || mediaFeature == MediaFeatureNames::transform3dMediaFeature
         || mediaFeature == MediaFeatureNames::transitionMediaFeature
         || mediaFeature == MediaFeatureNames::animationMediaFeature
-        || mediaFeature == MediaFeatureNames::view_modeMediaFeature
+        || mediaFeature == MediaFeatureNames::viewModeMediaFeature
         || mediaFeature == MediaFeatureNames::pointerMediaFeature
-        || mediaFeature == MediaFeatureNames::device_pixel_ratioMediaFeature
+        || mediaFeature == MediaFeatureNames::devicePixelRatioMediaFeature
         || mediaFeature == MediaFeatureNames::resolutionMediaFeature;
 }
 
+bool MediaQueryExp::isViewportDependent() const
+{
+    return m_mediaFeature == MediaFeatureNames::widthMediaFeature
+        || m_mediaFeature == MediaFeatureNames::heightMediaFeature
+        || m_mediaFeature == MediaFeatureNames::minWidthMediaFeature
+        || m_mediaFeature == MediaFeatureNames::minHeightMediaFeature
+        || m_mediaFeature == MediaFeatureNames::maxWidthMediaFeature
+        || m_mediaFeature == MediaFeatureNames::maxHeightMediaFeature
+        || m_mediaFeature == MediaFeatureNames::orientationMediaFeature
+        || m_mediaFeature == MediaFeatureNames::aspectRatioMediaFeature
+        || m_mediaFeature == MediaFeatureNames::minAspectRatioMediaFeature
+        || m_mediaFeature == MediaFeatureNames::maxAspectRatioMediaFeature;
+}
+
 inline MediaQueryExp::MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* valueList)
     : m_mediaFeature(mediaFeature)
     , m_value(0)
diff --git a/Source/core/css/MediaQueryExp.h b/Source/core/css/MediaQueryExp.h
index eba3a72..620e597 100644
--- a/Source/core/css/MediaQueryExp.h
+++ b/Source/core/css/MediaQueryExp.h
@@ -31,9 +31,9 @@
 
 #include "core/css/CSSValue.h"
 #include "core/css/MediaFeatureNames.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 class CSSParserValueList;
@@ -57,16 +57,7 @@
 
     bool isValid() const { return m_isValid; }
 
-    bool isViewportDependent() const { return m_mediaFeature == MediaFeatureNames::widthMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::heightMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::min_widthMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::min_heightMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::max_widthMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::max_heightMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::orientationMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::min_aspect_ratioMediaFeature
-                                            || m_mediaFeature == MediaFeatureNames::max_aspect_ratioMediaFeature;  }
+    bool isViewportDependent() const;
 
     String serialize() const;
 
diff --git a/Source/core/css/MediaQueryList.h b/Source/core/css/MediaQueryList.h
index 5601ec7..a15bc6a 100644
--- a/Source/core/css/MediaQueryList.h
+++ b/Source/core/css/MediaQueryList.h
@@ -20,9 +20,9 @@
 #ifndef MediaQueryList_h
 #define MediaQueryList_h
 
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/MediaQueryListListener.cpp b/Source/core/css/MediaQueryListListener.cpp
index 3ba1e83..1d7c2e4 100644
--- a/Source/core/css/MediaQueryListListener.cpp
+++ b/Source/core/css/MediaQueryListListener.cpp
@@ -20,20 +20,21 @@
 #include "config.h"
 #include "core/css/MediaQueryListListener.h"
 
+#include "V8MediaQueryList.h"
 #include "bindings/v8/ScriptFunctionCall.h"
 #include "core/css/MediaQueryList.h"
 
-#include "V8MediaQueryList.h"
-
 namespace WebCore {
 
 void MediaQueryListListener::queryChanged(ScriptState* state, MediaQueryList* query)
 {
     ScriptCallback callback(state, m_value);
     v8::HandleScope handleScope;
+
     v8::Handle<v8::Context> context = state->context();
     if (context.IsEmpty())
-       return; // JS may not be enabled.
+        return; // JS may not be enabled.
+
     v8::Context::Scope scope(context);
     callback.appendArgument(toV8(query, v8::Handle<v8::Object>(), context->GetIsolate()));
     callback.call();
diff --git a/Source/core/css/MediaQueryListListener.h b/Source/core/css/MediaQueryListListener.h
index c1c8fe2..f1d4441 100644
--- a/Source/core/css/MediaQueryListListener.h
+++ b/Source/core/css/MediaQueryListListener.h
@@ -22,8 +22,8 @@
 
 #include "bindings/v8/ScriptState.h"
 #include "bindings/v8/ScriptValue.h"
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/MediaQueryMatcher.cpp b/Source/core/css/MediaQueryMatcher.cpp
index 4ced467..b93fcc5 100644
--- a/Source/core/css/MediaQueryMatcher.cpp
+++ b/Source/core/css/MediaQueryMatcher.cpp
@@ -108,10 +108,8 @@
         return 0;
 
     RefPtr<MediaQuerySet> media = MediaQuerySet::create(query);
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     // Add warning message to inspector whenever dpi/dpcm values are used for "screen" media.
     reportMediaQueryWarningIfNeeded(m_document, media.get());
-#endif
     return MediaQueryList::create(this, media, evaluate(media.get()));
 }
 
diff --git a/Source/core/css/MediaQueryMatcher.h b/Source/core/css/MediaQueryMatcher.h
index e45cd64..6293f82 100644
--- a/Source/core/css/MediaQueryMatcher.h
+++ b/Source/core/css/MediaQueryMatcher.h
@@ -21,9 +21,9 @@
 #define MediaQueryMatcher_h
 
 #include "bindings/v8/ScriptState.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/RuleSet.cpp b/Source/core/css/RuleSet.cpp
index bc75db7..df8500c 100644
--- a/Source/core/css/RuleSet.cpp
+++ b/Source/core/css/RuleSet.cpp
@@ -46,7 +46,7 @@
 #include "core/css/WebKitCSSKeyframesRule.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #include "core/html/track/TextTrackCue.h"
 
@@ -300,16 +300,15 @@
 
         if (rule->isStyleRule()) {
             StyleRule* styleRule = static_cast<StyleRule*>(rule);
-            if (!scope)
-                addStyleRule(styleRule, addRuleFlags);
-            else {
-                const CSSSelectorList& selectorList = styleRule->selectorList();
-                for (size_t selectorIndex = 0; selectorIndex != notFound; selectorIndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) {
-                    if (selectorList.hasShadowDistributedAt(selectorIndex))
-                        resolver->ruleSets().shadowDistributedRules().addRule(styleRule, selectorIndex, const_cast<ContainerNode*>(scope), addRuleFlags);
-                    else
-                        addRule(styleRule, selectorIndex, addRuleFlags);
-                }
+
+            const CSSSelectorList& selectorList = styleRule->selectorList();
+            for (size_t selectorIndex = 0; selectorIndex != notFound; selectorIndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) {
+                if (selectorList.hasShadowDistributedAt(selectorIndex)) {
+                    if (!scope)
+                        continue;
+                    resolver->ruleSets().shadowDistributedRules().addRule(styleRule, selectorIndex, const_cast<ContainerNode*>(scope), addRuleFlags);
+                } else
+                    addRule(styleRule, selectorIndex, addRuleFlags);
             }
         } else if (rule->isPageRule())
             addPageRule(static_cast<StyleRulePage*>(rule));
diff --git a/Source/core/css/SVGCSSStyleSelector.cpp b/Source/core/css/SVGCSSStyleSelector.cpp
index ab07642..8bb0b27 100644
--- a/Source/core/css/SVGCSSStyleSelector.cpp
+++ b/Source/core/css/SVGCSSStyleSelector.cpp
@@ -107,7 +107,7 @@
     ASSERT(value);
     CSSPrimitiveValue* primitiveValue = 0;
     if (value->isPrimitiveValue())
-        primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        primitiveValue = toCSSPrimitiveValue(value);
 
     const StyleResolverState& state = m_state;
     SVGRenderStyle* svgstyle = state.style()->accessSVGStyle();
@@ -276,7 +276,7 @@
                 break;
             }
 
-            CSSValueList* dashes = static_cast<CSSValueList*>(value);
+            CSSValueList* dashes = toCSSValueList(value);
 
             Vector<SVGLength> array;
             size_t length = dashes->length();
@@ -285,7 +285,7 @@
                 if (!currValue->isPrimitiveValue())
                     continue;
 
-                CSSPrimitiveValue* dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
+                CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->itemWithoutBoundsCheck(i));
                 array.append(SVGLength::fromCSSPrimitiveValue(dash));
             }
 
@@ -557,7 +557,7 @@
             if (!value->isValueList())
                 return;
 
-            CSSValueList *list = static_cast<CSSValueList*>(value);
+            CSSValueList* list = toCSSValueList(value);
             if (!list->length())
                 return;
 
@@ -576,7 +576,7 @@
             ASSERT(!item->spread);
             ASSERT(!item->style);
 
-            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(location, blur, 0, Normal, false, color.isValid() ? color : Color::transparent));
+            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(location, blur, 0, Normal, color.isValid() ? color : Color::transparent));
             svgstyle->setShadow(shadowData.release());
             return;
         }
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 18a589f..0586571 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -35,9 +35,10 @@
 #include "core/dom/CustomElementRegistry.h"
 #include "core/dom/Document.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/StyledElement.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLFrameElementBase.h"
@@ -45,7 +46,6 @@
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLProgressElement.h"
 #include "core/html/HTMLStyleElement.h"
-#include "core/html/shadow/InsertionPoint.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/FocusController.h"
 #include "core/page/Frame.h"
diff --git a/Source/core/css/StyleInvalidationAnalysis.cpp b/Source/core/css/StyleInvalidationAnalysis.cpp
index f03111c..c3ec7ea 100644
--- a/Source/core/css/StyleInvalidationAnalysis.cpp
+++ b/Source/core/css/StyleInvalidationAnalysis.cpp
@@ -32,8 +32,8 @@
 #include "core/dom/ContainerNode.h"
 #include "core/dom/Document.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/StyledElement.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLStyleElement.h"
 
 namespace WebCore {
diff --git a/Source/core/css/StylePropertySerializer.cpp b/Source/core/css/StylePropertySerializer.cpp
index b54adc9..fb15f98 100644
--- a/Source/core/css/StylePropertySerializer.cpp
+++ b/Source/core/css/StylePropertySerializer.cpp
@@ -547,7 +547,7 @@
         values[i] = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
         if (values[i]) {
             if (values[i]->isBaseValueList()) {
-                CSSValueList* valueList = static_cast<CSSValueList*>(values[i].get());
+                CSSValueList* valueList = toCSSValueList(values[i].get());
                 numLayers = max(valueList->length(), numLayers);
             } else
                 numLayers = max<size_t>(1U, numLayers);
@@ -569,7 +569,7 @@
             RefPtr<CSSValue> value;
             if (values[j]) {
                 if (values[j]->isBaseValueList())
-                    value = static_cast<CSSValueList*>(values[j].get())->item(i);
+                    value = toCSSValueList(values[j].get())->item(i);
                 else {
                     value = values[j];
 
@@ -594,12 +594,12 @@
                     RefPtr<CSSValue> yValue;
                     RefPtr<CSSValue> nextValue = values[j + 1];
                     if (nextValue->isValueList())
-                        yValue = static_cast<CSSValueList*>(nextValue.get())->itemWithoutBoundsCheck(i);
+                        yValue = toCSSValueList(nextValue.get())->itemWithoutBoundsCheck(i);
                     else
                         yValue = nextValue;
 
-                    int xId = static_cast<CSSPrimitiveValue*>(value.get())->getIdent();
-                    int yId = static_cast<CSSPrimitiveValue*>(yValue.get())->getIdent();
+                    int xId = toCSSPrimitiveValue(value.get())->getIdent();
+                    int yId = toCSSPrimitiveValue(yValue.get())->getIdent();
                     if (xId != yId) {
                         if (xId == CSSValueRepeat && yId == CSSValueNoRepeat) {
                             useRepeatXShorthand = true;
diff --git a/Source/core/css/StyleRuleImport.cpp b/Source/core/css/StyleRuleImport.cpp
index 124f096..ebefb93 100644
--- a/Source/core/css/StyleRuleImport.cpp
+++ b/Source/core/css/StyleRuleImport.cpp
@@ -30,7 +30,7 @@
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
 #include "core/loader/cache/CachedResourceRequestInitiators.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/StyleSheetContents.cpp b/Source/core/css/StyleSheetContents.cpp
index b02d426..e8ab818 100644
--- a/Source/core/css/StyleSheetContents.cpp
+++ b/Source/core/css/StyleSheetContents.cpp
@@ -35,7 +35,7 @@
 #include "core/dom/Node.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/loader/cache/CachedCSSStyleSheet.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
@@ -137,11 +137,9 @@
         return;
     }
 
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
     // Add warning message to inspector if dpi/dpcm values are used for screen media.
     if (rule->isMediaRule())
         reportMediaQueryWarningIfNeeded(singleOwnerDocument(), static_cast<StyleRuleMedia*>(rule.get())->mediaQueries());
-#endif
 
     m_childRules.append(rule);
 }
@@ -149,7 +147,7 @@
 StyleRuleBase* StyleSheetContents::ruleAt(unsigned index) const
 {
     ASSERT_WITH_SECURITY_IMPLICATION(index < ruleCount());
-    
+
     unsigned childVectorIndex = index;
     if (hasCharsetRule()) {
         if (index == 0)
diff --git a/Source/core/css/WebKitCSSKeyframesRule.cpp b/Source/core/css/WebKitCSSKeyframesRule.cpp
index aaf6344..fc45877 100644
--- a/Source/core/css/WebKitCSSKeyframesRule.cpp
+++ b/Source/core/css/WebKitCSSKeyframesRule.cpp
@@ -180,11 +180,6 @@
     return m_keyframesRule->keyframes().size(); 
 }
 
-WebKitCSSKeyframeRule* WebKitCSSKeyframesRule::anonymousIndexedGetter(unsigned index) const
-{
-    return item(index);
-}
-
 WebKitCSSKeyframeRule* WebKitCSSKeyframesRule::item(unsigned index) const
 { 
     if (index >= length())
diff --git a/Source/core/css/WebKitCSSKeyframesRule.h b/Source/core/css/WebKitCSSKeyframesRule.h
index 242c0bd..241703f 100644
--- a/Source/core/css/WebKitCSSKeyframesRule.h
+++ b/Source/core/css/WebKitCSSKeyframesRule.h
@@ -88,7 +88,6 @@
 
     // For IndexedGetter and CSSRuleList.
     unsigned length() const;
-    WebKitCSSKeyframeRule* anonymousIndexedGetter(unsigned index) const;
     WebKitCSSKeyframeRule* item(unsigned index) const;
 
 private:
diff --git a/Source/core/css/WebKitCSSKeyframesRule.idl b/Source/core/css/WebKitCSSKeyframesRule.idl
index 69bd451..895d34e 100644
--- a/Source/core/css/WebKitCSSKeyframesRule.idl
+++ b/Source/core/css/WebKitCSSKeyframesRule.idl
@@ -33,7 +33,7 @@
     [TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString name;
     readonly attribute CSSRuleList cssRules;
     
-    getter WebKitCSSKeyframeRule(unsigned long index);
+    [ImplementedAs=item] getter WebKitCSSKeyframeRule(unsigned long index);
     void insertRule([Default=Undefined] optional DOMString rule);
     void deleteRule([Default=Undefined] optional DOMString key);
     WebKitCSSKeyframeRule findRule([Default=Undefined] optional DOMString key);
diff --git a/Source/core/css/WebKitCSSMatrix.cpp b/Source/core/css/WebKitCSSMatrix.cpp
index 7d83c49..4948e9e 100644
--- a/Source/core/css/WebKitCSSMatrix.cpp
+++ b/Source/core/css/WebKitCSSMatrix.cpp
@@ -65,7 +65,7 @@
         RefPtr<CSSValue> value = styleDeclaration->getPropertyCSSValue(CSSPropertyWebkitTransform);
 
         // Check for a "none" or empty transform. In these cases we can use the default identity matrix.
-        if (!value || (value->isPrimitiveValue() && (static_cast<CSSPrimitiveValue*>(value.get()))->getIdent() == CSSValueNone))
+        if (!value || (value->isPrimitiveValue() && (toCSSPrimitiveValue(value.get()))->getIdent() == CSSValueNone))
             return;
 
         TransformOperations operations;
diff --git a/Source/core/css/fullscreenQuickTime.css b/Source/core/css/fullscreenQuickTime.css
deleted file mode 100644
index c8a38e1..0000000
--- a/Source/core/css/fullscreenQuickTime.css
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-/* alternate media controls - Extend fullscreen.css */
-
-video:-webkit-full-screen::-webkit-media-controls-panel {
-    -webkit-align-items: flex-start !important;
-    -webkit-justify-content: flex-end !important;
-    -webkit-appearance: none !important;
-
-    padding: 12px 0 0 10px !important;
-    width: 430px !important;
-    height: 48px !important;
-    margin: 0 auto 50px auto !important;
-    
-    background-image: -webkit-gradient(
-        linear,
-        left top,
-        left bottom,
-        color-stop(0, rgba(30, 30, 30, .97)),
-        color-stop(0.333, rgba(45, 45, 45, .97)),
-        color-stop(0.35,  rgba(25, 25, 25, .97)),
-        color-stop(0.366, rgba(25, 25, 25, .97)),
-        color-stop(0.366, rgba(12, 12, 12, .97)),
-        color-stop(1, rgba(19, 19, 19, .97))
-    ) !important;
-
-    -webkit-box-shadow: 
-        inset 0 -1px 1px rgba(0, 0, 0, 0.5),
-        inset 0  1px 0 0px   rgba(255, 255, 255, 0.15),
-        inset 0 -1px 0 0px   rgba(202, 202, 202, 0.09),
-        0  0   0 1px rgba(0, 0, 0, 0.5);
-    border-radius: 8px !important;
-
-    -webkit-transition: opacity 0.3s linear !important;
-}
-
-video:-webkit-animating-full-screen-transition::-webkit-media-controls-panel {
-    opacity: 0 ! important;
-    -webkit-transition: opacity 0 ! important;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-mute-button {
-    display: none;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-volume-slider-container {
-    display: none;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-volume-slider {
-    display: none;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-volume-slider-mute-button {
-    display: none;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-fullscreen-volume-min-button {
-    -webkit-appearance: media-mute-button;
-    display: block;
-    position: absolute;
-    left: 11px;
-    top: 15px;
-    width: 17px;
-    height: 14px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-fullscreen-volume-slider {
-    -webkit-appearance: media-fullscreen-volume-slider;
-    display: block;
-    position: absolute;
-    left: 28px;
-    top: 14px;
-    height: 11px;
-    width: 50px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-fullscreen-volume-max-button {
-    -webkit-appearance: media-mute-button;
-    display: block;
-    position: absolute;
-    left: 84px;
-    top: 15px;
-    width: 17px;
-    height: 14px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-play-button {
-    position: absolute;
-    width: 22px;
-    height: 23px;
-    left: 209px;
-    top: 9px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-rewind-button {
-    position: absolute;
-    left: 162px;
-    top: 13px;
-    width: 18px;
-    height: 18px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-seek-back-button {
-    position: absolute;
-    display: -webkit-flex;
-    width: 23px;
-    height: 16px;
-    left: 162px;
-    top: 13px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-return-to-realtime-button {
-    position: absolute;
-    display: -webkit-flex;
-    width: 29px;
-    height: 16px;
-    left: 262px;
-    top: 13px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-seek-forward-button {
-    position: absolute;
-    display: -webkit-flex;
-    width: 23px;
-    height: 16px;
-    left: 262px;
-    top: 13px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-timeline-container {
-    height: auto;
-    width: 420px;
-    position: absolute;
-    bottom: 9px;
-    left: 8px;
-    right: 8px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-status-display {
-    width: 420px;
-    position: absolute;
-    bottom: 9px;
-    left: 8px;
-    right: 8px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-closed-captions-container {
-    bottom: 64px;
-    right: 38px;
-}
-
-video:-webkit-full-screen::-webkit-media-controls-closed-captions-track-list {
-    max-height: 500px;
-}
diff --git a/Source/core/css/html.css b/Source/core/css/html.css
index 90e414c..65edad7 100644
--- a/Source/core/css/html.css
+++ b/Source/core/css/html.css
@@ -497,17 +497,6 @@
     -webkit-padding-start: 1px;
 }
 
-#if defined(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) && ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE
-input[type="datetime"] {
-    -webkit-align-items: center;
-    display: -webkit-inline-flex;
-    font-family: monospace;
-    overflow: hidden;
-    padding: 0;
-    -webkit-padding-start: 1px;
-}
-#endif
-
 input[type="datetime-local"] {
     -webkit-align-items: center;
     display: -webkit-inline-flex;
diff --git a/Source/core/css/resolver/FilterOperationResolver.cpp b/Source/core/css/resolver/FilterOperationResolver.cpp
index 50b4dfc..45b8c7e 100644
--- a/Source/core/css/resolver/FilterOperationResolver.cpp
+++ b/Source/core/css/resolver/FilterOperationResolver.cpp
@@ -119,7 +119,7 @@
         CSSValue* value = values->itemWithoutBoundsCheck(i);
         if (!value->isPrimitiveValue())
             return 0;
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
             return 0;
         arrayParameter->addValue(primitiveValue->getDoubleValue());
@@ -134,7 +134,7 @@
         CSSValue* value = values->itemWithoutBoundsCheck(i);
         if (!value->isPrimitiveValue())
             return 0;
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
             return 0;
         numberParameter->addValue(primitiveValue->getDoubleValue());
@@ -162,7 +162,7 @@
     if (!parameterValue->isValueList())
         return 0;
 
-    CSSValueList* values = static_cast<CSSValueList*>(parameterValue);
+    CSSValueList* values = toCSSValueList(parameterValue);
     if (!values->length())
         return 0;
 
@@ -181,7 +181,7 @@
     if (!values->itemWithoutBoundsCheck(0)->isPrimitiveValue() || values->length() > 4)
         return 0;
 
-    CSSPrimitiveValue* firstPrimitiveValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(0));
+    CSSPrimitiveValue* firstPrimitiveValue = toCSSPrimitiveValue(values->itemWithoutBoundsCheck(0));
     if (firstPrimitiveValue->primitiveType() == CSSPrimitiveValue::CSS_NUMBER)
         return parseCustomFilterNumberParameter(name, values);
 
@@ -201,7 +201,7 @@
         CSSValueListIterator iterator(parameterIterator.value());
         if (!iterator.isPrimitiveValue())
             return false;
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(iterator.value());
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(iterator.value());
         if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_STRING)
             return false;
 
@@ -258,7 +258,7 @@
 {
     CSSValue* shadersValue = filterValue->itemWithoutBoundsCheck(0);
     ASSERT_WITH_SECURITY_IMPLICATION(shadersValue->isValueList());
-    CSSValueList* shadersList = static_cast<CSSValueList*>(shadersValue);
+    CSSValueList* shadersList = toCSSValueList(shadersValue);
 
     unsigned shadersListLength = shadersList->length();
     ASSERT(shadersListLength);
@@ -280,7 +280,7 @@
 
             ASSERT(mixFunction->length() <= 3);
             while (iterator.hasMore()) {
-                CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(iterator.value());
+                CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(iterator.value());
                 if (CSSParser::isBlendMode(primitiveValue->getIdent()))
                     mixSettings.blendMode = *primitiveValue;
                 else if (CSSParser::isCompositeOperator(primitiveValue->getIdent()))
@@ -312,7 +312,7 @@
         // the mesh-box list, if not it means it is the parameters list.
 
         if (iterator.hasMore() && iterator.isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(iterator.value());
+            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(iterator.value());
             if (primitiveValue->isNumber()) {
                 // If only one integer value is specified, it will set both
                 // the rows and the columns.
@@ -321,7 +321,7 @@
 
                 // Try to match another number for the rows.
                 if (iterator.hasMore() && iterator.isPrimitiveValue()) {
-                    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(iterator.value());
+                    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(iterator.value());
                     if (primitiveValue->isNumber()) {
                         meshRows = primitiveValue->getIntValue();
                         iterator.advance();
@@ -331,7 +331,7 @@
         }
 
         if (iterator.hasMore() && iterator.isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(iterator.value());
+            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(iterator.value());
             if (primitiveValue->getIdent() == CSSValueDetached) {
                 meshType = MeshTypeDetached;
                 iterator.advance();
@@ -373,7 +373,7 @@
         return false;
 
     if (inValue->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(inValue);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inValue);
         if (primitiveValue->getIdent() == CSSValueNone)
             return true;
     }
@@ -442,7 +442,7 @@
                 continue;
         }
 
-        CSSPrimitiveValue* firstValue = filterValue->length() ? static_cast<CSSPrimitiveValue*>(filterValue->itemWithoutBoundsCheck(0)) : 0;
+        CSSPrimitiveValue* firstValue = filterValue->length() && filterValue->itemWithoutBoundsCheck(0)->isPrimitiveValue() ? toCSSPrimitiveValue(filterValue->itemWithoutBoundsCheck(0)) : 0;
         switch (filterValue->operationType()) {
         case WebKitCSSFilterValue::GrayscaleFilterOperation:
         case WebKitCSSFilterValue::SepiaFilterOperation:
diff --git a/Source/core/css/resolver/ScopedStyleResolver.cpp b/Source/core/css/resolver/ScopedStyleResolver.cpp
index 18889f5..7dddf9f 100644
--- a/Source/core/css/resolver/ScopedStyleResolver.cpp
+++ b/Source/core/css/resolver/ScopedStyleResolver.cpp
@@ -33,11 +33,11 @@
 #include "core/css/RuleFeature.h"
 #include "core/css/RuleSet.h"
 #include "core/dom/ContextFeatures.h"
-#include "core/dom/ElementShadow.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLStyleElement.h"
-#include "core/html/shadow/ContentDistributor.h"
 #include "wtf/MemoryInstrumentationHashMap.h"
 #include "wtf/MemoryInstrumentationHashSet.h"
 #include "wtf/MemoryInstrumentationVector.h"
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index bc32ad3..e90aeae 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -83,13 +83,14 @@
 #include "core/dom/Attribute.h"
 #include "core/dom/ContextFeatures.h"
 #include "core/dom/DocumentStyleSheetCollection.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
 #include "core/dom/VisitedLinkState.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLIFrameElement.h"
@@ -98,7 +99,6 @@
 #include "core/html/HTMLProgressElement.h"
 #include "core/html/HTMLStyleElement.h"
 #include "core/html/HTMLTextAreaElement.h"
-#include "core/html/shadow/InsertionPoint.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/cache/CachedImage.h"
 #include "core/page/Frame.h"
@@ -125,7 +125,7 @@
 #include "core/rendering/style/StylePendingImage.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGFontFaceElement.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include "wtf/MemoryInstrumentationHashMap.h"
 #include "wtf/MemoryInstrumentationHashSet.h"
 #include "wtf/MemoryInstrumentationVector.h"
@@ -2264,7 +2264,7 @@
     if (!value->isPrimitiveValue())
         return false;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     Pair* minMaxTrackBreadth = primitiveValue->getPairValue();
     if (!minMaxTrackBreadth) {
         GridLength workingLength;
@@ -2288,7 +2288,7 @@
 {
     // Handle 'none'.
     if (value->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         return primitiveValue->getIdent() == CSSValueNone;
     }
 
@@ -2299,7 +2299,7 @@
     for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
         CSSValue* currValue = i.value();
         if (currValue->isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(currValue);
+            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(currValue);
             if (primitiveValue->isString()) {
                 NamedGridLinesMap::AddResult result = namedGridLines.add(primitiveValue->getStringValue(), Vector<size_t>());
                 result.iterator->value.append(currentNamedGridLine);
@@ -2326,7 +2326,7 @@
 {
     // For now, we only accept: 'auto' | <integer> | span && <integer>?
     if (value->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         if (primitiveValue->getIdent() == CSSValueAuto)
             return true;
 
@@ -2341,11 +2341,9 @@
         return true;
     }
 
-    ASSERT_WITH_SECURITY_IMPLICATION(value->isValueList());
-    CSSValueList* values = static_cast<CSSValueList*>(value);
+    CSSValueList* values = toCSSValueList(value);
     ASSERT(values->length() == 2);
-    ASSERT_WITH_SECURITY_IMPLICATION(values->itemWithoutBoundsCheck(1)->isPrimitiveValue());
-    CSSPrimitiveValue* numericValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(1));
+    CSSPrimitiveValue* numericValue = toCSSPrimitiveValue(values->itemWithoutBoundsCheck(1));
     ASSERT(numericValue->isNumber());
     position.setSpanPosition(numericValue->getIntValue());
     return true;
@@ -2354,7 +2352,7 @@
 static bool hasVariableReference(CSSValue* value)
 {
     if (value->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
         return primitiveValue->hasVariableReference();
     }
 
@@ -2447,7 +2445,7 @@
         return;
     }
 
-    CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? static_cast<CSSPrimitiveValue*>(value) : 0;
+    CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value) : 0;
 
     float zoomFactor = state.style()->effectiveZoom();
 
@@ -2484,7 +2482,7 @@
                 }
 
                 if (item->isImageValue()) {
-                    state.style()->setContent(cachedOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageValue*>(item)), didSet);
+                    state.style()->setContent(cachedOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet);
                     didSet = true;
                     continue;
                 }
@@ -2492,7 +2490,7 @@
                 if (!item->isPrimitiveValue())
                     continue;
 
-                CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(item);
+                CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
 
                 if (contentValue->isString()) {
                     state.style()->setContent(contentValue->getStringValue().impl(), didSet);
@@ -2556,7 +2554,7 @@
             return;
         }
         if (value->isValueList()) {
-            CSSValueList* list = static_cast<CSSValueList*>(value);
+            CSSValueList* list = toCSSValueList(value);
             RefPtr<QuotesData> quotes = QuotesData::create();
             for (size_t i = 0; i < list->length(); i += 2) {
                 CSSValue* first = list->itemWithoutBoundsCheck(i);
@@ -2564,10 +2562,8 @@
                 CSSValue* second = list->item(i + 1);
                 if (!second)
                     continue;
-                ASSERT_WITH_SECURITY_IMPLICATION(first->isPrimitiveValue());
-                ASSERT_WITH_SECURITY_IMPLICATION(second->isPrimitiveValue());
-                String startQuote = static_cast<CSSPrimitiveValue*>(first)->getStringValue();
-                String endQuote = static_cast<CSSPrimitiveValue*>(second)->getStringValue();
+                String startQuote = toCSSPrimitiveValue(first)->getStringValue();
+                String endQuote = toCSSPrimitiveValue(second)->getStringValue();
                 quotes->addPair(std::make_pair(startQuote, endQuote));
             }
             state.style()->setQuotes(quotes);
@@ -2710,7 +2706,7 @@
             else if (state.style())
                 color = state.style()->color();
 
-            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent));
+            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(IntPoint(x, y), blur, spread, shadowStyle, color.isValid() ? color : Color::transparent));
             if (id == CSSPropertyTextShadow)
                 state.style()->setTextShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry
             else
@@ -2943,7 +2939,7 @@
             return;
 
         FontDescription fontDescription = state.style()->fontDescription();
-        CSSValueList* list = static_cast<CSSValueList*>(value);
+        CSSValueList* list = toCSSValueList(value);
         RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create();
         int len = list->length();
         for (int i = 0; i < len; ++i) {
@@ -3298,7 +3294,7 @@
 PassRefPtr<StyleImage> StyleResolver::styleImage(CSSPropertyID property, CSSValue* value)
 {
     if (value->isImageValue())
-        return cachedOrPendingFromValue(property, static_cast<CSSImageValue*>(value));
+        return cachedOrPendingFromValue(property, toCSSImageValue(value));
 
     if (value->isImageGeneratorValue()) {
         if (value->isGradientValue())
diff --git a/Source/core/css/resolver/TransformBuilder.cpp b/Source/core/css/resolver/TransformBuilder.cpp
index a9ccdcf..cd3bd39 100644
--- a/Source/core/css/resolver/TransformBuilder.cpp
+++ b/Source/core/css/resolver/TransformBuilder.cpp
@@ -116,7 +116,7 @@
         if (haveNonPrimitiveValue)
             continue;
 
-        CSSPrimitiveValue* firstValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(0));
+        CSSPrimitiveValue* firstValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(0));
 
         switch (transformValue->operationType()) {
         case WebKitCSSTransformValue::ScaleTransformOperation:
@@ -130,7 +130,7 @@
                 sx = firstValue->getDoubleValue();
                 if (transformValue->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
                     if (transformValue->length() > 1) {
-                        CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+                        CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
                         sy = secondValue->getDoubleValue();
                     } else
                         sy = sx;
@@ -152,11 +152,11 @@
                 sx = firstValue->getDoubleValue();
                 if (transformValue->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
                     if (transformValue->length() > 2) {
-                        CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2));
+                        CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(2));
                         sz = thirdValue->getDoubleValue();
                     }
                     if (transformValue->length() > 1) {
-                        CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+                        CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
                         sy = secondValue->getDoubleValue();
                     } else
                         sy = sx;
@@ -176,7 +176,7 @@
                 tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
                 if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
                     if (transformValue->length() > 1) {
-                        CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+                        CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
                         ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);
                     }
                 }
@@ -201,11 +201,11 @@
                 tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
                 if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
                     if (transformValue->length() > 2) {
-                        CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2));
+                        CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(2));
                         tz = convertToFloatLength(thirdValue, style, rootStyle, zoomFactor);
                     }
                     if (transformValue->length() > 1) {
-                        CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+                        CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
                         ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);
                     }
                 }
@@ -242,9 +242,9 @@
         case WebKitCSSTransformValue::Rotate3DTransformOperation: {
             if (transformValue->length() < 4)
                 break;
-            CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
-            CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2));
-            CSSPrimitiveValue* fourthValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(3));
+            CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
+            CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(2));
+            CSSPrimitiveValue* fourthValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(3));
             double x = firstValue->getDoubleValue();
             double y = secondValue->getDoubleValue();
             double z = thirdValue->getDoubleValue();
@@ -264,7 +264,7 @@
                 angleX = angle;
                 if (transformValue->operationType() == WebKitCSSTransformValue::SkewTransformOperation) {
                     if (transformValue->length() > 1) {
-                        CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+                        CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
                         angleY = secondValue->computeDegrees();
                     }
                 }
@@ -276,33 +276,33 @@
             if (transformValue->length() < 6)
                 break;
             double a = firstValue->getDoubleValue();
-            double b = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1))->getDoubleValue();
-            double c = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2))->getDoubleValue();
-            double d = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(3))->getDoubleValue();
-            double e = zoomFactor * static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(4))->getDoubleValue();
-            double f = zoomFactor * static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(5))->getDoubleValue();
+            double b = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1))->getDoubleValue();
+            double c = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(2))->getDoubleValue();
+            double d = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(3))->getDoubleValue();
+            double e = zoomFactor * toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(4))->getDoubleValue();
+            double f = zoomFactor * toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(5))->getDoubleValue();
             operations.operations().append(MatrixTransformOperation::create(a, b, c, d, e, f));
             break;
         }
         case WebKitCSSTransformValue::Matrix3DTransformOperation: {
             if (transformValue->length() < 16)
                 break;
-            TransformationMatrix matrix(static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(0))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(3))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(4))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(5))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(6))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(7))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(8))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(9))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(10))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(11))->getDoubleValue(),
-                zoomFactor * static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(12))->getDoubleValue(),
-                zoomFactor * static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(13))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(14))->getDoubleValue(),
-                static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(15))->getDoubleValue());
+            TransformationMatrix matrix(toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(0))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(2))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(3))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(4))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(5))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(6))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(7))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(8))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(9))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(10))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(11))->getDoubleValue(),
+                zoomFactor * toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(12))->getDoubleValue(),
+                zoomFactor * toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(13))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(14))->getDoubleValue(),
+                toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(15))->getDoubleValue());
             operations.operations().append(Matrix3DTransformOperation::create(matrix));
             break;
         }
diff --git a/Source/core/css/resolver/ViewportStyleResolver.cpp b/Source/core/css/resolver/ViewportStyleResolver.cpp
index 8071f1d..ac30e8c 100644
--- a/Source/core/css/resolver/ViewportStyleResolver.cpp
+++ b/Source/core/css/resolver/ViewportStyleResolver.cpp
@@ -113,7 +113,7 @@
     if (!value || !value->isPrimitiveValue())
         return defaultValue;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value.get());
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get());
 
     if (primitiveValue->isNumber() || primitiveValue->isPx())
         return primitiveValue->getFloatValue();
diff --git a/Source/core/css/themeBlackBerry.css b/Source/core/css/themeBlackBerry.css
deleted file mode 100644
index 8ce6643..0000000
--- a/Source/core/css/themeBlackBerry.css
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-textarea {
-    font-family: monospace;
-}
-
-/* If the select do not have multiple nor size larger than 1 attribute, which are menulist appearance, we wanna change text color when it is actived. */
-input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]:active::-webkit-file-upload-button, button:active, select:not([multiple]):not([size]):active, select[size="0"]:active, select[size="1"]:active {
-    color: #fafafa;
-}
-
-input[type="button"]:active:disabled, input[type="submit"]:active:disabled, input[type="reset"]:active:disabled, input[type="file"]:active:disabled::-webkit-file-upload-button, button:active:disabled, select:not([multiple]):not([size]):active:disabled, select[size="0"]:active:disabled, select[size="1"]:active:disabled {
-    color: GrayText;
-}
-
-select {
-    border-radius: 0;
-}
-
-select[size="0"],
-select[size="1"] {
-    border-radius: 0;
-}
-
-::-webkit-validation-bubble-message {
-    padding-left: 10px;
-    padding-right: 10px;
-    background: #fafafa;
-    border-color: #ffffff;
-    border-width: 1px;
-    box-shadow: 2px 2px 4px rgba(100,100,100,0.3), 0 0 4px rgba(100,100,100,0.6);
-    -webkit-border-radius: 4px;
-    top: -1px;
-}
-
-::-webkit-validation-bubble-arrow {
-    left: 40px;
-    top: 3px;
-    background: #fafafa;
-    border-color: #ffffff;
-    border-width: 1px;
-    box-shadow: 0 0 4px rgba(100,100,100,0.6);
-}
-
-::-webkit-validation-bubble-heading {
-    font-weight: normal;
-}
-
-
-/* Suggestion Box */
-
-input::-webkit-suggestion-dropdown-box {
-    position: absolute;
-    z-index: 2147483647;
-    opacity: 0.98;
-    max-height: 200px;
-    overflow-y: scroll;
-    overflow-x: hidden;
-    border: 1px solid #e0e0e0;
-    border-top: none;
-    background-color: #fcfcfc;
-    -webkit-box-shadow: 0px 5px 5px -2px #606060 inset;
-    -webkit-box-shadow: 2px 0px 8px -5px #AEAEAE;
-}
-
-input::-webkit-suggestion-dropdown-box-item {
-    display: block;
-    width: 100%;
-    padding: 10px 5px;
-    color: #363636;
-    text-decoration: none;
-    border-bottom: 1px solid #e8e8e8;
-    text-overflow: -blackberry-fade;
-    overflow: hidden;
-}
-
-input::-webkit-suggestion-prefix-text {
-    font-weight: bold;
-}
-
-input::-webkit-suggestion-dropdown-box-item-last {
-    display: block;
-    width: 100%;
-    padding: 10px 5px;
-    color: #363636;
-    text-decoration: none;
-    text-overflow: -blackberry-fade;
-    overflow: hidden;
-    border-bottom: none;
-}
-
-input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="time"], input[type="month"] {
-    font-family: "Slate Pro";
-    -webkit-appearance: button;
-    text-align: center;
-}
diff --git a/Source/core/dom/Attr.cpp b/Source/core/dom/Attr.cpp
index 4751272..3aa4dab 100644
--- a/Source/core/dom/Attr.cpp
+++ b/Source/core/dom/Attr.cpp
@@ -85,6 +85,7 @@
         // This does everything appendChild() would do in this situation (assuming m_ignoreChildrenChanged was set),
         // but much more efficiently.
         textNode->setParentOrShadowHostNode(this);
+        treeScope()->adoptIfNeeded(textNode.get());
         setFirstChild(textNode.get());
         setLastChild(textNode.get());
     }
diff --git a/Source/core/dom/CharacterData.idl b/Source/core/dom/CharacterData.idl
index 4b45308..6491b8e 100644
--- a/Source/core/dom/CharacterData.idl
+++ b/Source/core/dom/CharacterData.idl
@@ -37,7 +37,9 @@
                                     [IsIndex,Default=Undefined] optional unsigned long length,
                                     [Default=Undefined] optional DOMString data);
 
-    // DOM 4
+    // ChildNode interface API
+    readonly attribute Element previousElementSibling;
+    readonly attribute Element nextElementSibling;
     [RaisesException] void remove();
 };
 
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index 4256a59..7c3ff41 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -30,10 +30,11 @@
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/MutationEvent.h"
+#include "core/dom/NodeRareData.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/TemplateContentDocumentFragment.h"
-#include "core/html/shadow/InsertionPoint.h"
+#include "core/html/HTMLCollection.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/cache/MemoryCache.h"
 #include "core/page/Chrome.h"
@@ -825,6 +826,35 @@
     }
 }
 
+PassRefPtr<HTMLCollection> ContainerNode::children()
+{
+    return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLCollection>(this, NodeChildren);
+}
+
+Element* ContainerNode::firstElementChild() const
+{
+    return ElementTraversal::firstWithin(this);
+}
+
+Element* ContainerNode::lastElementChild() const
+{
+    Node* n = lastChild();
+    while (n && !n->isElementNode())
+        n = n->previousSibling();
+    return toElement(n);
+}
+
+unsigned ContainerNode::childElementCount() const
+{
+    unsigned count = 0;
+    Node* n = firstChild();
+    while (n) {
+        count += n->isElementNode();
+        n = n->nextSibling();
+    }
+    return count;
+}
+
 unsigned ContainerNode::childNodeCount() const
 {
     unsigned count = 0;
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index e96dc0f..b29abf7 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -33,7 +33,8 @@
 namespace WebCore {
 
 class FloatPoint;
-    
+class HTMLCollection;
+
 typedef void (*NodeCallback)(Node*, unsigned);
 
 namespace Private { 
@@ -86,6 +87,12 @@
     Node* lastChild() const { return m_lastChild; }
     bool hasChildNodes() const { return m_firstChild; }
 
+    // ParentNode interface API
+    PassRefPtr<HTMLCollection> children();
+    Element* firstElementChild() const;
+    Element* lastElementChild() const;
+    unsigned childElementCount() const;
+
     unsigned childNodeCount() const;
     Node* childNode(unsigned index) const;
 
diff --git a/Source/core/dom/ContainerNodeAlgorithms.cpp b/Source/core/dom/ContainerNodeAlgorithms.cpp
index 5a3a513..59d65ed 100644
--- a/Source/core/dom/ContainerNodeAlgorithms.cpp
+++ b/Source/core/dom/ContainerNodeAlgorithms.cpp
@@ -27,7 +27,7 @@
 #include "core/dom/ContainerNodeAlgorithms.h"
 
 #include "core/dom/Element.h"
-#include "core/dom/ElementShadow.h"
+#include "core/dom/shadow/ElementShadow.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 
 namespace WebCore {
diff --git a/Source/core/dom/ContextFeatures.h b/Source/core/dom/ContextFeatures.h
index 3f56c11..b46b85e 100644
--- a/Source/core/dom/ContextFeatures.h
+++ b/Source/core/dom/ContextFeatures.h
@@ -28,7 +28,6 @@
 #define ContextFeatures_h
 
 #include "core/platform/RefCountedSupplement.h"
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp
index 7118c1c..07c6c66 100644
--- a/Source/core/dom/DOMImplementation.cpp
+++ b/Source/core/dom/DOMImplementation.cpp
@@ -51,7 +51,7 @@
 #include "core/platform/graphics/Image.h"
 #include "core/platform/graphics/MediaPlayer.h"
 #include "core/plugins/PluginData.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #if ENABLE(SVG)
 #include "SVGNames.h"
@@ -302,7 +302,7 @@
     return doc.release();
 }
 
-PassRefPtr<CSSStyleSheet> DOMImplementation::createCSSStyleSheet(const String&, const String& media, ExceptionCode&)
+PassRefPtr<CSSStyleSheet> DOMImplementation::createCSSStyleSheet(const String&, const String& media)
 {
     // FIXME: Title should be set.
     // FIXME: Media could have wrong syntax, in which case we should generate an exception.
diff --git a/Source/core/dom/DOMImplementation.h b/Source/core/dom/DOMImplementation.h
index 918e766..fe2c31d 100644
--- a/Source/core/dom/DOMImplementation.h
+++ b/Source/core/dom/DOMImplementation.h
@@ -58,7 +58,7 @@
     DOMImplementation* getInterface(const String& feature);
 
     // From the DOMImplementationCSS interface
-    static PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media, ExceptionCode&);
+    static PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media);
 
     // From the HTMLDOMImplementation interface
     PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
diff --git a/Source/core/dom/DOMImplementation.idl b/Source/core/dom/DOMImplementation.idl
index 960e2df..d7ef3be 100644
--- a/Source/core/dom/DOMImplementation.idl
+++ b/Source/core/dom/DOMImplementation.idl
@@ -39,8 +39,8 @@
 
     // DOMImplementationCSS interface from DOM Level 2 CSS
 
-     [RaisesException] CSSStyleSheet createCSSStyleSheet([Default=Undefined] optional DOMString title,
-                                                     [Default=Undefined] optional DOMString media);
+     CSSStyleSheet createCSSStyleSheet([Default=Undefined] optional DOMString title,
+                                       [Default=Undefined] optional DOMString media);
 
     // HTMLDOMImplementation interface from DOM Level 2 HTML
 
diff --git a/Source/core/dom/DOMNamedFlowCollection.cpp b/Source/core/dom/DOMNamedFlowCollection.cpp
index b882120..47107a1 100644
--- a/Source/core/dom/DOMNamedFlowCollection.cpp
+++ b/Source/core/dom/DOMNamedFlowCollection.cpp
@@ -38,6 +38,7 @@
 DOMNamedFlowCollection::DOMNamedFlowCollection(const Vector<NamedFlow*>& namedFlows)
 {
     ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled());
+    ScriptWrappable::init(this);
     for (Vector<NamedFlow*>::const_iterator it = namedFlows.begin(); it != namedFlows.end(); ++it)
         m_namedFlows.add(*it);
 }
diff --git a/Source/core/dom/DOMNamedFlowCollection.h b/Source/core/dom/DOMNamedFlowCollection.h
index 739fad3..0a87b2b 100644
--- a/Source/core/dom/DOMNamedFlowCollection.h
+++ b/Source/core/dom/DOMNamedFlowCollection.h
@@ -29,6 +29,7 @@
 #ifndef DOMNamedFlowCollection_h
 #define DOMNamedFlowCollection_h
 
+#include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/NamedFlowCollection.h"
 #include <wtf/ListHashSet.h>
 #include <wtf/PassRefPtr.h>
@@ -40,7 +41,7 @@
 class Document;
 class NamedFlow;
 
-class DOMNamedFlowCollection : public RefCounted<DOMNamedFlowCollection> {
+class DOMNamedFlowCollection : public ScriptWrappable, public RefCounted<DOMNamedFlowCollection> {
 public:
     static PassRefPtr<DOMNamedFlowCollection> create(const Vector<NamedFlow*>& namedFlows)
     {
diff --git a/Source/core/dom/DOMStringList.h b/Source/core/dom/DOMStringList.h
index d365799..f4dddd3 100644
--- a/Source/core/dom/DOMStringList.h
+++ b/Source/core/dom/DOMStringList.h
@@ -26,6 +26,7 @@
 #ifndef DOMStringList_h
 #define DOMStringList_h
 
+#include "bindings/v8/ScriptWrappable.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
@@ -35,7 +36,7 @@
 
 // FIXME: Some consumers of this class may benefit from lazily fetching items rather
 //        than creating the list statically as is currently the only option.
-class DOMStringList : public RefCounted<DOMStringList> {
+class DOMStringList : public ScriptWrappable, public RefCounted<DOMStringList> {
 public:
     static PassRefPtr<DOMStringList> create()
     {
@@ -55,7 +56,10 @@
     operator const Vector<String>&() const { return m_strings; }
 
 private:
-    DOMStringList() { }
+    DOMStringList()
+    {
+        ScriptWrappable::init(this);
+    }
 
     Vector<String> m_strings;
 };
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 6cf7bcc..84cf458 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -74,7 +74,6 @@
 #include "core/dom/DocumentStyleSheetCollection.h"
 #include "core/dom/DocumentType.h"
 #include "core/dom/Element.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventFactory.h"
 #include "core/dom/EventListener.h"
@@ -100,13 +99,14 @@
 #include "core/dom/ScriptRunner.h"
 #include "core/dom/ScriptedAnimationController.h"
 #include "core/dom/SelectorQuery.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/TouchList.h"
 #include "core/dom/TransformSource.h"
 #include "core/dom/TreeWalker.h"
 #include "core/dom/UserActionElementSet.h"
 #include "core/dom/VisitedLinkState.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/htmlediting.h"
@@ -193,9 +193,9 @@
 #include "core/xml/XSLTProcessor.h"
 #include "core/xml/parser/XMLDocumentParser.h"
 #include "modules/geolocation/GeolocationController.h"
-#include "origin/SchemeRegistry.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/SchemeRegistry.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
 
 #if ENABLE(SVG)
 #include "SVGElementFactory.h"
@@ -2048,9 +2048,6 @@
     if (ScriptableDocumentParser* parser = scriptableDocumentParser())
         parser->setWasCreatedByScript(true);
 
-    if (DOMWindow* domWindow = this->domWindow())
-        domWindow->removeAllEventListeners();
-
     if (m_frame)
         m_frame->loader()->didExplicitOpen();
 }
@@ -4206,18 +4203,6 @@
     return m_iconURLs;
 }
 
-void Document::addIconURL(const String& url, const String&, const String&, IconType iconType)
-{
-    if (url.isEmpty())
-        return;
-
-    Frame* f = frame();
-    if (!f)
-        return;
-
-    f->loader()->didChangeIcons(iconType);
-}
-
 void Document::setUseSecureKeyboardEntryWhenActive(bool usesSecureKeyboard)
 {
     if (m_useSecureKeyboardEntryWhenActive == usesSecureKeyboard)
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index 14d4b4b..2da5a7e 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -45,7 +45,7 @@
 #include "core/page/FocusDirection.h"
 #include "core/page/PageVisibilityState.h"
 #include "core/platform/PlatformScreen.h"
-#include "origin/ReferrerPolicy.h"
+#include "weborigin/ReferrerPolicy.h"
 #include "core/platform/Timer.h"
 #include "core/platform/graphics/Color.h"
 #include "core/platform/graphics/IntRect.h"
@@ -893,7 +893,6 @@
 
     const Vector<IconURL>& shortcutIconURLs();
     const Vector<IconURL>& iconURLs(int iconTypesMask);
-    void addIconURL(const String& url, const String& mimeType, const String& size, IconType);
 
     void setUseSecureKeyboardEntryWhenActive(bool);
     bool useSecureKeyboardEntryWhenActive() const;
diff --git a/Source/core/dom/Document.idl b/Source/core/dom/Document.idl
index 7f756cf..02f2bb5 100644
--- a/Source/core/dom/Document.idl
+++ b/Source/core/dom/Document.idl
@@ -150,7 +150,7 @@
                                            [Default=Undefined] optional long y);
 
     // Mozilla extensions
-    DOMSelection       getSelection();
+    Selection          getSelection();
     [TreatReturnedNullStringAs=Null] readonly attribute DOMString characterSet;
 
     // WebKit extensions
@@ -286,7 +286,12 @@
     readonly attribute boolean webkitHidden;
 
     // Security Policy API: http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-interfaces
-    [EnabledAtRuntime=experimentalContentSecurityPolicyFeatures] readonly attribute DOMSecurityPolicy securityPolicy;
+    [EnabledAtRuntime=experimentalContentSecurityPolicyFeatures] readonly attribute SecurityPolicy securityPolicy;
 
+    // ParentNode interface API
+    readonly attribute HTMLCollection children;
+    readonly attribute Element firstElementChild;
+    readonly attribute Element lastElementChild;
+    readonly attribute unsigned long childElementCount;
 };
 
diff --git a/Source/core/dom/DocumentFragment.idl b/Source/core/dom/DocumentFragment.idl
index 0837e78..01ca5de 100644
--- a/Source/core/dom/DocumentFragment.idl
+++ b/Source/core/dom/DocumentFragment.idl
@@ -25,5 +25,11 @@
     // NodeSelector - Selector API
     [RaisesException] Element querySelector(DOMString selectors);
     [RaisesException] NodeList querySelectorAll(DOMString selectors);
+
+    // ParentNode interface API
+    readonly attribute HTMLCollection children;
+    readonly attribute Element firstElementChild;
+    readonly attribute Element lastElementChild;
+    readonly attribute unsigned long childElementCount;
 };
 
diff --git a/Source/core/dom/DocumentMarker.h b/Source/core/dom/DocumentMarker.h
index ce63fa6..e8e6d9f 100644
--- a/Source/core/dom/DocumentMarker.h
+++ b/Source/core/dom/DocumentMarker.h
@@ -41,31 +41,7 @@
     enum MarkerType {
         Spelling = 1 << 0,
         Grammar = 1 << 1,
-        TextMatch = 1 << 2,
-        // Text has been modified by spell correction, reversion of spell correction or other type of substitution. 
-        // On some platforms, this prevents the text from being autocorrected again. On post Snow Leopard Mac OS X, 
-        // if a Replacement marker contains non-empty description, a reversion UI will be shown.
-        Replacement = 1 << 3,
-        // Renderer needs to add underline indicating that the text has been modified by spell
-        // correction. Text with Replacement marker doesn't necessarily has CorrectionIndicator
-        // marker. For instance, after some text has been corrected, it will have both Replacement
-        // and CorrectionIndicator. However, if user further modifies such text, we would remove
-        // CorrectionIndicator marker, but retain Replacement marker.
-        CorrectionIndicator = 1 << 4,
-        // Correction suggestion has been offered, but got rejected by user.
-        RejectedCorrection = 1 << 5,
-        // Text has been modified by autocorrection. The description of this marker is the original text before autocorrection.
-        Autocorrected = 1 << 6,
-        // On some platforms, this prevents the text from being spellchecked again.
-        SpellCheckingExemption = 1 << 7,
-        // This marker indicates user has deleted an autocorrection starting at the end of the
-        // range that bears this marker. In some platforms, if the user later inserts the same original
-        // word again at this position, it will not be autocorrected again. The description of this
-        // marker is the original word before autocorrection was applied.
-        DeletedAutocorrection = 1 << 8,
-        // This marker indicates that the range of text spanned by the marker is entered by voice dictation,
-        // and it has alternative text.
-        DictationAlternatives = 1 << 9
+        TextMatch = 1 << 2
     };
 
     class MarkerTypes {
@@ -87,7 +63,7 @@
     class AllMarkers : public MarkerTypes {
     public:
         AllMarkers()
-            : MarkerTypes(Spelling | Grammar | TextMatch | Replacement | CorrectionIndicator | RejectedCorrection | Autocorrected | SpellCheckingExemption | DeletedAutocorrection | DictationAlternatives)
+            : MarkerTypes(Spelling | Grammar | TextMatch)
         {
         }
     };
diff --git a/Source/core/dom/DocumentMarkerController.cpp b/Source/core/dom/DocumentMarkerController.cpp
index 90d3a15..0928c3d 100644
--- a/Source/core/dom/DocumentMarkerController.cpp
+++ b/Source/core/dom/DocumentMarkerController.cpp
@@ -50,13 +50,14 @@
 {
 }
 
+DocumentMarkerController::~DocumentMarkerController()
+{
+}
+
 void DocumentMarkerController::detach()
 {
-    m_possiblyExistingMarkerTypes = 0;
-    if (m_markers.isEmpty())
-        return;
-    deleteAllValues(m_markers);
     m_markers.clear();
+    m_possiblyExistingMarkerTypes = 0;
 }
 
 void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerType type, const String& description, uint32_t hash)
@@ -143,12 +144,11 @@
 
     m_possiblyExistingMarkerTypes.add(newMarker.type());
 
-    MarkerList* list = m_markers.get(node);
+    OwnPtr<MarkerList>& list = m_markers.add(node, nullptr).iterator->value;
 
     if (!list) {
-        list = new MarkerList;
+        list = adoptPtr(new MarkerList);
         list->append(RenderedDocumentMarker(newMarker));
-        m_markers.set(node, list);
     } else {
         RenderedDocumentMarker toInsert(newMarker);
         size_t numMarkers = list->size();
@@ -295,11 +295,9 @@
 
     if (list->isEmpty()) {
         m_markers.remove(node);
-        delete list;
+        if (m_markers.isEmpty())
+            m_possiblyExistingMarkerTypes = 0;
     }
-    
-    if (m_markers.isEmpty())
-        m_possiblyExistingMarkerTypes = 0;
 
     // repaint the affected node
     if (docDirty && node->renderer())
@@ -316,7 +314,7 @@
     MarkerMap::iterator end = m_markers.end();
     for (MarkerMap::iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
         // inner loop; process each marker in this node
-        MarkerList* list = nodeIterator->value;
+        MarkerList* list = nodeIterator->value.get();
         unsigned markerCount = list->size();
         for (unsigned markerIndex = 0; markerIndex < markerCount; ++markerIndex) {
             RenderedDocumentMarker& marker = list->at(markerIndex);
@@ -414,7 +412,7 @@
     MarkerMap::iterator end = m_markers.end();
     for (MarkerMap::iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
         // inner loop; process each marker in this node
-        MarkerList* list = nodeIterator->value;
+        MarkerList* list = nodeIterator->value.get();
         unsigned markerCount = list->size();
         for (unsigned markerIndex = 0; markerIndex < markerCount; ++markerIndex) {
             const RenderedDocumentMarker& marker = list->at(markerIndex);
@@ -441,7 +439,7 @@
     
     MarkerMap::iterator iterator = m_markers.find(node);
     if (iterator != m_markers.end())
-        removeMarkersFromList(node, iterator->value, markerTypes);
+        removeMarkersFromList(iterator, markerTypes);
 }
 
 void DocumentMarkerController::removeMarkers(DocumentMarker::MarkerTypes markerTypes)
@@ -450,25 +448,30 @@
         return;
     ASSERT(!m_markers.isEmpty());
 
-    // outer loop: process each markered node in the document
-    MarkerMap markerMapCopy = m_markers;
-    MarkerMap::iterator end = markerMapCopy.end();
-    for (MarkerMap::iterator i = markerMapCopy.begin(); i != end; ++i)
-        removeMarkersFromList(i->key.get(), i->value, markerTypes);
+    Vector<RefPtr<Node> > nodesWithMarkers;
+    copyKeysToVector(m_markers, nodesWithMarkers);
+    unsigned size = nodesWithMarkers.size();
+    for (unsigned i = 0; i < size; ++i) {
+        MarkerMap::iterator iterator = m_markers.find(nodesWithMarkers[i]);
+        if (iterator != m_markers.end())
+            removeMarkersFromList(iterator, markerTypes);
+    }
+
     m_possiblyExistingMarkerTypes.remove(markerTypes);
 }
 
-// This function may release node and vectorPair.
-void DocumentMarkerController::removeMarkersFromList(Node* node, MarkerList* list, DocumentMarker::MarkerTypes markerTypes)
+void DocumentMarkerController::removeMarkersFromList(MarkerMap::iterator iterator, DocumentMarker::MarkerTypes markerTypes)
 {
+    bool needsRepainting = false;
+    bool listCanBeRemoved;
+
     if (markerTypes == DocumentMarker::AllMarkers()) {
-        delete list;
-        m_markers.remove(node);
-        if (RenderObject* renderer = node->renderer())
-            renderer->repaint();
+        needsRepainting = true;
+        listCanBeRemoved = true;
     } else {
-        bool needsRepaint = false;
-        for (size_t i = 0; i != list->size();) {
+        MarkerList* list = iterator->value.get();
+
+        for (size_t i = 0; i != list->size(); ) {
             DocumentMarker marker = list->at(i);
 
             // skip nodes that are not of the specified type
@@ -479,26 +482,23 @@
 
             // pitch the old marker
             list->remove(i);
-            needsRepaint = true;
+            needsRepainting = true;
             // i now is the index of the next marker
         }
 
-        // Redraw the node if it changed. Do this before the node is removed from m_markers, since
-        // m_markers might contain the last reference to the node.
-        if (needsRepaint) {
-            RenderObject* renderer = node->renderer();
-            if (renderer)
-                renderer->repaint();
-        }
-
-        // delete the node's list if it is now empty
-        if (list->isEmpty()) {
-            m_markers.remove(node);
-            delete list;
-        }
+        listCanBeRemoved = list->isEmpty();
     }
-    if (m_markers.isEmpty())
-        m_possiblyExistingMarkerTypes = 0;
+
+    if (needsRepainting) {
+        if (RenderObject* renderer = iterator->key->renderer())
+            renderer->repaint();
+    }
+
+    if (listCanBeRemoved) {
+        m_markers.remove(iterator);
+        if (m_markers.isEmpty())
+            m_possiblyExistingMarkerTypes = 0;
+    }
 }
 
 void DocumentMarkerController::repaintMarkers(DocumentMarker::MarkerTypes markerTypes)
@@ -513,7 +513,7 @@
         Node* node = i->key.get();
 
         // inner loop: process each marker in the current node
-        MarkerList* list = i->value;
+        MarkerList* list = i->value.get();
         bool nodeNeedsRepaint = false;
         for (size_t i = 0; i != list->size(); ++i) {
             DocumentMarker marker = list->at(i);
@@ -541,7 +541,7 @@
     for (MarkerMap::iterator i = m_markers.begin(); i != end; ++i) {
 
         // inner loop: process each rect in the current node
-        MarkerList* list = i->value;
+        MarkerList* list = i->value.get();
         for (size_t listIndex = 0; listIndex < list->size(); ++listIndex)
             list->at(listIndex).invalidate(r);
     }
@@ -649,41 +649,6 @@
     return false;
 }
 
-void DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange(Range* range, DocumentMarker::MarkerTypes markerTypes)
-{
-    if (!possiblyHasMarkers(markerTypes))
-        return;
-    ASSERT(!m_markers.isEmpty());
-
-    Node* startContainer = range->startContainer();
-    Node* endContainer = range->endContainer();
-
-    Node* pastLastNode = range->pastLastNode();
-    for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTraversal::next(node)) {
-        unsigned startOffset = node == startContainer ? range->startOffset() : 0;
-        unsigned endOffset = node == endContainer ? static_cast<unsigned>(range->endOffset()) : std::numeric_limits<unsigned>::max();
-        MarkerList* list = m_markers.get(node);
-        if (!list)
-            continue;
-
-        for (size_t i = 0; i < list->size(); ++i) {
-            DocumentMarker& marker = list->at(i);
-
-            // markers are returned in order, so stop if we are now past the specified range
-            if (marker.startOffset() >= endOffset)
-                break;
-
-            // skip marker that is wrong type or before target
-            if (marker.endOffset() <= startOffset || !markerTypes.contains(marker.type())) {
-                i++;
-                continue;
-            }
-
-            marker.clearDetails();
-        }
-    }
-}
-
 #ifndef NDEBUG
 void DocumentMarkerController::showMarkers() const
 {
@@ -692,7 +657,7 @@
     for (MarkerMap::const_iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
         Node* node = nodeIterator->key.get();
         fprintf(stderr, "%p", node);
-        MarkerList* list = nodeIterator->value;
+        MarkerList* list = nodeIterator->value.get();
         for (unsigned markerIndex = 0; markerIndex < list->size(); ++markerIndex) {
             const DocumentMarker& marker = list->at(markerIndex);
             fprintf(stderr, " %d:[%d:%d](%d)", marker.type(), marker.startOffset(), marker.endOffset(), marker.activeMatch());
@@ -705,7 +670,6 @@
 
 } // namespace WebCore
 
-
 #ifndef NDEBUG
 void showDocumentMarkers(const WebCore::DocumentMarkerController* controller)
 {
diff --git a/Source/core/dom/DocumentMarkerController.h b/Source/core/dom/DocumentMarkerController.h
index 095c295..b73bcd1 100644
--- a/Source/core/dom/DocumentMarkerController.h
+++ b/Source/core/dom/DocumentMarkerController.h
@@ -45,7 +45,7 @@
 public:
 
     DocumentMarkerController();
-    ~DocumentMarkerController() { detach(); }
+    ~DocumentMarkerController();
 
     void detach();
     void addMarker(Range*, DocumentMarker::MarkerType);
@@ -79,7 +79,6 @@
     Vector<DocumentMarker> markersForNode(Node*);
     Vector<DocumentMarker*> markers();
     Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType);
-    void clearDescriptionOnMarkersIntersectingRange(Range*, DocumentMarker::MarkerTypes);
 
 #ifndef NDEBUG
     void showMarkers() const;
@@ -89,9 +88,9 @@
     void addMarker(Node*, const DocumentMarker&);
 
     typedef Vector<RenderedDocumentMarker> MarkerList;
-    typedef HashMap<RefPtr<Node>, MarkerList*> MarkerMap;
+    typedef HashMap<RefPtr<Node>, OwnPtr<MarkerList> > MarkerMap;
     bool possiblyHasMarkers(DocumentMarker::MarkerTypes);
-    void removeMarkersFromList(Node*, MarkerList*, DocumentMarker::MarkerTypes);
+    void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes);
 
     MarkerMap m_markers;
     // Provide a quick way to determine whether a particular marker type is absent without going through the map.
diff --git a/Source/core/dom/DocumentType.idl b/Source/core/dom/DocumentType.idl
index 5cd61a9..352da12 100644
--- a/Source/core/dom/DocumentType.idl
+++ b/Source/core/dom/DocumentType.idl
@@ -31,7 +31,9 @@
     [TreatReturnedNullStringAs=Null] readonly attribute DOMString systemId;
     [TreatReturnedNullStringAs=Null] readonly attribute DOMString internalSubset;        
 
-    // DOM 4
+    // ChildNode interface API
+    readonly attribute Element previousElementSibling;
+    readonly attribute Element nextElementSibling;
     [RaisesException] void remove();
 };
 
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index cd5ec55..e8645e2 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -53,9 +53,10 @@
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/PseudoElement.h"
 #include "core/dom/SelectorQuery.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
 #include "core/editing/htmlediting.h"
@@ -71,7 +72,6 @@
 #include "core/html/HTMLTableRowsCollection.h"
 #include "core/html/VoidCallback.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/html/shadow/InsertionPoint.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/FocusController.h"
 #include "core/page/Frame.h"
@@ -289,18 +289,27 @@
 PassRefPtr<Attr> Element::detachAttribute(size_t index)
 {
     ASSERT(elementData());
+    const Attribute* attribute = elementData()->attributeItem(index);
+    RefPtr<Attr> attrNode = attrIfExists(attribute->name());
+    if (attrNode)
+        detachAttrNodeAtIndex(attrNode.get(), index);
+    else {
+        attrNode = Attr::create(document(), attribute->name(), attribute->value());
+        removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
+    }
+    return attrNode.release();
+}
+
+void Element::detachAttrNodeAtIndex(Attr* attr, size_t index)
+{
+    ASSERT(attr);
+    ASSERT(elementData());
 
     const Attribute* attribute = elementData()->attributeItem(index);
     ASSERT(attribute);
-
-    RefPtr<Attr> attrNode = attrIfExists(attribute->name());
-    if (attrNode)
-        detachAttrNodeFromElementWithValue(attrNode.get(), attribute->value());
-    else
-        attrNode = Attr::create(document(), attribute->name(), attribute->value());
-
+    ASSERT(attribute->name() == attr->qualifiedName());
+    detachAttrNodeFromElementWithValue(attr, attribute->value());
     removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
-    return attrNode.release();
 }
 
 void Element::removeAttribute(const QualifiedName& name)
@@ -1443,12 +1452,10 @@
             change = Force;
         }
 
-        if (change != Force) {
-            if (styleChangeType() >= FullStyleChange)
-                change = Force;
-            else
-                change = localChange;
-        }
+        if (styleChangeType() == FullStyleChange)
+            change = Force;
+        else if (change != Force)
+            change = localChange;
     }
     StyleResolverParentPusher parentPusher(this);
 
@@ -1800,13 +1807,15 @@
 
     synchronizeAttribute(attr->qualifiedName());
 
-    size_t index = elementData()->getAttributeItemIndex(attr->qualifiedName());
+    size_t index = elementData()->getAttrIndex(attr);
     if (index == notFound) {
         ec = NOT_FOUND_ERR;
         return 0;
     }
 
-    return detachAttribute(index);
+    RefPtr<Attr> guard(attr);
+    detachAttrNodeAtIndex(attr, index);
+    return guard.release();
 }
 
 bool Element::parseAttributeName(QualifiedName& out, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionCode& ec)
@@ -2336,31 +2345,6 @@
     return 0;
 }
 
-// ElementTraversal API
-Element* Element::firstElementChild() const
-{
-    return ElementTraversal::firstWithin(this);
-}
-
-Element* Element::lastElementChild() const
-{
-    Node* n = lastChild();
-    while (n && !n->isElementNode())
-        n = n->previousSibling();
-    return toElement(n);
-}
-
-unsigned Element::childElementCount() const
-{
-    unsigned count = 0;
-    Node* n = firstChild();
-    while (n) {
-        count += n->isElementNode();
-        n = n->nextSibling();
-    }
-    return count;
-}
-
 bool Element::matchesReadOnlyPseudoClass() const
 {
     return false;
@@ -3113,6 +3097,16 @@
         info.addMember(*attributeItem(i), "*attributeItem");
 }
 
+size_t ElementData::getAttrIndex(Attr* attr) const
+{
+    // This relies on the fact that Attr's QualifiedName == the Attribute's name.
+    for (unsigned i = 0; i < length(); ++i) {
+        if (attributeItem(i)->name() == attr->qualifiedName())
+            return i;
+    }
+    return notFound;
+}
+
 size_t ElementData::getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const
 {
     // Continue to checking case-insensitively and/or full namespaced names if necessary:
diff --git a/Source/core/dom/Element.h b/Source/core/dom/Element.h
index 8b2580b..f5870e2 100644
--- a/Source/core/dom/Element.h
+++ b/Source/core/dom/Element.h
@@ -80,6 +80,7 @@
     const Attribute* getAttributeItem(const QualifiedName&) const;
     size_t getAttributeItemIndex(const QualifiedName&) const;
     size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
+    size_t getAttrIndex(Attr*) const;
 
     bool hasID() const { return !m_idForStyleResolution.isNull(); }
     bool hasClass() const { return !m_classNames.isNull(); }
@@ -503,13 +504,6 @@
     bool childNeedsShadowWalker() const;
     void didShadowTreeAwareChildrenChange();
 
-    // ElementTraversal API
-    Element* firstElementChild() const;
-    Element* lastElementChild() const;
-    Element* previousElementSibling() const;
-    Element* nextElementSibling() const;
-    unsigned childElementCount() const;
-
     virtual bool matchesReadOnlyPseudoClass() const;
     virtual bool matchesReadWritePseudoClass() const;
     bool webkitMatchesSelector(const String& selectors, ExceptionCode&);
@@ -555,6 +549,7 @@
     virtual bool isDisabledFormControl() const;
 
     bool isInert() const;
+    virtual bool shouldBeReparentedUnderRenderView(const RenderStyle*) const { return isInTopLayer(); }
 
 #if ENABLE(SVG)
     virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
@@ -723,6 +718,7 @@
 
     void detachAllAttrNodesFromElement();
     void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value);
+    void detachAttrNodeAtIndex(Attr*, size_t index);
 
     void createRendererIfNeeded();
 
@@ -777,7 +773,7 @@
     return parent && parent->isElementNode() ? toElement(parent) : 0;
 }
 
-inline Element* Element::previousElementSibling() const
+inline Element* Node::previousElementSibling() const
 {
     Node* n = previousSibling();
     while (n && !n->isElementNode())
@@ -785,7 +781,7 @@
     return static_cast<Element*>(n);
 }
 
-inline Element* Element::nextElementSibling() const
+inline Element* Node::nextElementSibling() const
 {
     Node* n = nextSibling();
     while (n && !n->isElementNode())
diff --git a/Source/core/dom/Element.idl b/Source/core/dom/Element.idl
index 76136bc..52be687 100644
--- a/Source/core/dom/Element.idl
+++ b/Source/core/dom/Element.idl
@@ -101,11 +101,10 @@
     // WebKit extension, pending specification.
     [RaisesException] boolean webkitMatchesSelector([Default=Undefined] optional DOMString selectors);
 
-    // ElementTraversal API
+    // ParentNode interface API
+    [PerWorldBindings] readonly attribute HTMLCollection children;
     [PerWorldBindings] readonly attribute Element firstElementChild;
     [PerWorldBindings] readonly attribute Element lastElementChild;
-    [PerWorldBindings] readonly attribute Element previousElementSibling;
-    [PerWorldBindings] readonly attribute Element nextElementSibling;
     [PerWorldBindings] readonly attribute unsigned long childElementCount;
 
     // ShadowAware API
@@ -114,7 +113,9 @@
     [ImplementedAs=shadowRoot, PerWorldBindings] readonly attribute ShadowRoot webkitShadowRoot;
     [ImplementedAs=insertionParentForBinding, PerWorldBindings] readonly attribute Node webkitInsertionParent;
 
-    // DOM 4
+    // ChildNode interface API
+    [PerWorldBindings] readonly attribute Element previousElementSibling;
+    [PerWorldBindings] readonly attribute Element nextElementSibling;
     [RaisesException] void remove();
 
     // CSSOM View Module API
diff --git a/Source/core/dom/ElementRareData.h b/Source/core/dom/ElementRareData.h
index fe35129..3c512cb 100644
--- a/Source/core/dom/ElementRareData.h
+++ b/Source/core/dom/ElementRareData.h
@@ -24,10 +24,10 @@
 
 #include "core/animation/Animation.h"
 #include "core/dom/DatasetDOMStringMap.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/NamedNodeMap.h"
 #include "core/dom/NodeRareData.h"
 #include "core/dom/PseudoElement.h"
+#include "core/dom/shadow/ElementShadow.h"
 #include "core/html/ClassList.h"
 #include "core/html/ime/InputMethodContext.h"
 #include "core/rendering/style/StyleInheritedData.h"
diff --git a/Source/core/dom/Event.cpp b/Source/core/dom/Event.cpp
index de51a3f..4fc4330 100644
--- a/Source/core/dom/Event.cpp
+++ b/Source/core/dom/Event.cpp
@@ -206,16 +206,15 @@
 {
     if (!m_currentTarget || !m_currentTarget->toNode())
         return StaticNodeList::createEmpty();
-    TreeScope* currentScope = m_currentTarget->toNode()->treeScope();
-    Vector<RefPtr<Node> > nodes;
+    Node* node = m_currentTarget->toNode();
     size_t eventPathSize = m_eventPath.size();
     for (size_t i = 0; i < eventPathSize; ++i) {
-        Node* node = m_eventPath[i]->node();
-        ASSERT(node);
-        if (node->treeScope()->isInclusiveAncestorOf(currentScope))
-            nodes.append(node);
+        if (node == m_eventPath[i]->node()) {
+            ASSERT(m_eventPath[i]->eventPath());
+            return m_eventPath[i]->eventPath();
+        }
     }
-    return StaticNodeList::adopt(nodes);
+    return StaticNodeList::createEmpty();
 }
 
 } // namespace WebCore
diff --git a/Source/core/dom/EventContext.cpp b/Source/core/dom/EventContext.cpp
index 7b8dd56..30a44c5 100644
--- a/Source/core/dom/EventContext.cpp
+++ b/Source/core/dom/EventContext.cpp
@@ -32,6 +32,7 @@
 #include "core/dom/FocusEvent.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/Node.h"
+#include "core/dom/StaticNodeList.h"
 #include "core/dom/TouchEvent.h"
 #include "core/dom/TouchList.h"
 #include "core/page/DOMWindow.h"
@@ -51,6 +52,11 @@
 {
 }
 
+void EventContext::adoptEventPath(Vector<RefPtr<Node> >& nodes)
+{
+    m_eventPath = StaticNodeList::adopt(nodes);
+}
+
 void EventContext::handleLocalEvents(Event* event) const
 {
     event->setTarget(m_target.get());
diff --git a/Source/core/dom/EventContext.h b/Source/core/dom/EventContext.h
index 5017e5c..5e4f136 100644
--- a/Source/core/dom/EventContext.h
+++ b/Source/core/dom/EventContext.h
@@ -29,6 +29,7 @@
 
 #include "core/dom/EventTarget.h"
 #include "core/dom/Node.h"
+#include "core/dom/StaticNodeList.h"
 #include "core/dom/TreeScope.h"
 #include <wtf/RefPtr.h>
 
@@ -45,6 +46,10 @@
 
     Node* node() const { return m_node.get(); }
     EventTarget* target() const { return m_target.get(); }
+    PassRefPtr<NodeList> eventPath() { return m_eventPath; }
+    void adoptEventPath(Vector<RefPtr<Node> >&);
+    void setEventPath(PassRefPtr<NodeList> nodeList) { m_eventPath = nodeList; }
+
     bool currentTargetSameAsTarget() const { return m_currentTarget.get() == m_target.get(); }
     virtual void handleLocalEvents(Event*) const;
     virtual bool isMouseOrFocusEventContext() const;
@@ -57,6 +62,7 @@
     RefPtr<Node> m_node;
     RefPtr<EventTarget> m_currentTarget;
     RefPtr<EventTarget> m_target;
+    RefPtr<NodeList> m_eventPath;
 };
 
 typedef Vector<OwnPtr<EventContext>, 32> EventPath;
diff --git a/Source/core/dom/EventDispatcher.cpp b/Source/core/dom/EventDispatcher.cpp
index 9465946..ccec89c 100644
--- a/Source/core/dom/EventDispatcher.cpp
+++ b/Source/core/dom/EventDispatcher.cpp
@@ -27,17 +27,17 @@
 #include "core/dom/EventDispatcher.h"
 
 #include "core/dom/ContainerNode.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/EventContext.h"
 #include "core/dom/EventDispatchMediator.h"
 #include "core/dom/EventPathWalker.h"
 #include "core/dom/EventRetargeter.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/ScopedEventQueue.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/WindowEventContext.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLMediaElement.h"
-#include "core/html/shadow/InsertionPoint.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/FrameView.h"
 #include <wtf/RefPtr.h>
diff --git a/Source/core/dom/EventPathWalker.cpp b/Source/core/dom/EventPathWalker.cpp
index 2adac7b..b29af07 100644
--- a/Source/core/dom/EventPathWalker.cpp
+++ b/Source/core/dom/EventPathWalker.cpp
@@ -27,9 +27,9 @@
 #include "config.h"
 #include "core/dom/EventPathWalker.h"
 
-#include "core/dom/ShadowRoot.h"
-#include "core/html/shadow/ContentDistributor.h"
-#include "core/html/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventRetargeter.cpp b/Source/core/dom/EventRetargeter.cpp
index 297fa6c..502a570 100644
--- a/Source/core/dom/EventRetargeter.cpp
+++ b/Source/core/dom/EventRetargeter.cpp
@@ -20,16 +20,17 @@
 #include "config.h"
 #include "core/dom/EventRetargeter.h"
 
+#include "RuntimeEnabledFeatures.h"
 #include "core/dom/ContainerNode.h"
 #include "core/dom/EventContext.h"
 #include "core/dom/EventPathWalker.h"
 #include "core/dom/FocusEvent.h"
 #include "core/dom/MouseEvent.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Touch.h"
 #include "core/dom/TouchEvent.h"
 #include "core/dom/TouchList.h"
 #include "core/dom/TreeScope.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
@@ -103,6 +104,28 @@
             targetStack.removeLast();
         }
     }
+
+    // Calculates eventPath for each node for Event.path() API.
+    if (!RuntimeEnabledFeatures::experimentalShadowDOMEnabled())
+        return;
+    TreeScope* lastScope = 0;
+    size_t eventPathSize = eventPath.size();
+    for (size_t i = 0; i < eventPathSize; ++i) {
+        TreeScope* currentScope = eventPath[i]->node()->treeScope();
+        if (currentScope == lastScope) {
+            // Fast path.
+            eventPath[i]->setEventPath(eventPath[i - 1]->eventPath());
+            continue;
+        }
+        lastScope = currentScope;
+        Vector<RefPtr<Node> > nodes;
+        for (size_t j = 0; j < eventPathSize; ++j) {
+            Node* node = eventPath[j]->node();
+            if (node->treeScope()->isInclusiveAncestorOf(currentScope))
+                nodes.append(node);
+        }
+        eventPath[i]->adoptEventPath(nodes);
+    }
 }
 
 void EventRetargeter::adjustForMouseEvent(Node* node, MouseEvent& mouseEvent)
diff --git a/Source/core/dom/EventRetargeter.h b/Source/core/dom/EventRetargeter.h
index d88e674..3e89f0f 100644
--- a/Source/core/dom/EventRetargeter.h
+++ b/Source/core/dom/EventRetargeter.h
@@ -22,7 +22,7 @@
 
 #include "core/dom/ContainerNode.h"
 #include "core/dom/EventContext.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
diff --git a/Source/core/dom/EventTarget.h b/Source/core/dom/EventTarget.h
index 7bf80c9..2039839 100644
--- a/Source/core/dom/EventTarget.h
+++ b/Source/core/dom/EventTarget.h
@@ -55,7 +55,6 @@
     class MIDIInput;
     class MIDIPort;
     class MediaController;
-    class MediaSource;
     class MediaStream;
     class MessagePort;
     class NamedFlow;
@@ -66,9 +65,10 @@
     class ScriptProcessorNode;
     class SharedWorker;
     class SharedWorkerContext;
-    class SourceBufferList;
     class TextTrack;
     class TextTrackCue;
+    class WebKitMediaSource;
+    class WebKitSourceBufferList;
     class WebSocket;
     class Worker;
     class XMLHttpRequest;
diff --git a/Source/core/dom/EventTargetFactory.in b/Source/core/dom/EventTargetFactory.in
index c62e1da..dc3235b 100644
--- a/Source/core/dom/EventTargetFactory.in
+++ b/Source/core/dom/EventTargetFactory.in
@@ -26,8 +26,8 @@
 modules/indexeddb/IDBOpenDBRequest
 modules/indexeddb/IDBRequest
 modules/indexeddb/IDBTransaction
-modules/mediasource/MediaSource
-modules/mediasource/SourceBufferList
+modules/mediasource/WebKitMediaSource
+modules/mediasource/WebKitSourceBufferList
 modules/mediastream/MediaStream
 modules/mediastream/MediaStreamTrack
 modules/mediastream/RTCDataChannel
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp
index 0068061..d505c66 100644
--- a/Source/core/dom/MessagePort.cpp
+++ b/Source/core/dom/MessagePort.cpp
@@ -36,7 +36,7 @@
 #include "core/page/DOMWindow.h"
 #include "core/platform/Timer.h"
 #include "core/workers/WorkerContext.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 79136ad..3223aa7 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -48,7 +48,6 @@
 #include "core/dom/DocumentType.h"
 #include "core/dom/Element.h"
 #include "core/dom/ElementRareData.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventContext.h"
 #include "core/dom/EventDispatchMediator.h"
@@ -74,7 +73,6 @@
 #include "core/dom/RegisteredEventListener.h"
 #include "core/dom/ScopedEventQueue.h"
 #include "core/dom/SelectorQuery.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/StaticNodeList.h"
 #include "core/dom/TagNodeList.h"
 #include "core/dom/TemplateContentDocumentFragment.h"
@@ -88,6 +86,9 @@
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/dom/WheelEvent.h"
 #include "core/dom/WindowEventContext.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/htmlediting.h"
 #include "core/html/DOMSettableTokenList.h"
 #include "core/html/HTMLElement.h"
@@ -95,7 +96,6 @@
 #include "core/html/HTMLStyleElement.h"
 #include "core/html/LabelsNodeList.h"
 #include "core/html/RadioNodeList.h"
-#include "core/html/shadow/InsertionPoint.h"
 #include "core/inspector/InspectorCounters.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
@@ -1284,7 +1284,10 @@
 
 Node* Node::insertionParentForBinding() const
 {
-    return resolveReprojection(this);
+    Node* node = resolveReprojection(this);
+    while (node && node->containingShadowRoot() && node->containingShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot)
+        node = resolveReprojection(node);
+    return node;
 }
 
 bool Node::needsShadowTreeWalkerSlow() const
diff --git a/Source/core/dom/Node.h b/Source/core/dom/Node.h
index b919d19..b571f9c 100644
--- a/Source/core/dom/Node.h
+++ b/Source/core/dom/Node.h
@@ -90,11 +90,11 @@
 // SyntheticStyleChange means that we need to go through the entire style change logic even though
 // no style property has actually changed. It is used to restructure the tree when, for instance,
 // RenderLayers are created or destroyed due to animation changes.
-enum StyleChangeType { 
-    NoStyleChange = 0, 
-    InlineStyleChange = 1 << nodeStyleChangeShift, 
-    FullStyleChange = 2 << nodeStyleChangeShift, 
-    SyntheticStyleChange = 3 << nodeStyleChangeShift
+enum StyleChangeType {
+    NoStyleChange = 0,
+    InlineStyleChange = 1 << nodeStyleChangeShift,
+    SyntheticStyleChange = 2 << nodeStyleChangeShift,
+    FullStyleChange = 3 << nodeStyleChangeShift,
 };
 
 class NodeRareDataBase {
@@ -186,6 +186,11 @@
     bool hasAttributes() const;
     NamedNodeMap* attributes() const;
 
+    // ChildNode interface API
+    Element* previousElementSibling() const;
+    Element* nextElementSibling() const;
+    void remove(ExceptionCode&);
+
     Node* pseudoAwareNextSibling() const;
     Node* pseudoAwarePreviousSibling() const;
     Node* pseudoAwareFirstChild() const;
@@ -203,7 +208,6 @@
     bool removeChild(Node* child, ExceptionCode&);
     bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, AttachBehavior = AttachNow);
 
-    void remove(ExceptionCode&);
     bool hasChildNodes() const { return firstChild(); }
     virtual PassRefPtr<Node> cloneNode(bool deep) = 0;
     const AtomicString& localName() const { return virtualLocalName(); }
diff --git a/Source/core/dom/NodeRenderingContext.cpp b/Source/core/dom/NodeRenderingContext.cpp
index acdfbbd..1533f0a 100644
--- a/Source/core/dom/NodeRenderingContext.cpp
+++ b/Source/core/dom/NodeRenderingContext.cpp
@@ -29,13 +29,13 @@
 #include "HTMLNames.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/ContainerNode.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Node.h"
 #include "core/dom/PseudoElement.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLInputElement.h"
-#include "core/html/shadow/ContentDistributor.h"
 #include "core/html/shadow/HTMLContentElement.h"
 #include "core/html/shadow/HTMLShadowElement.h"
 #include "core/rendering/FlowThreadController.h"
@@ -79,7 +79,7 @@
         return false;
     if (renderer->style() && !renderer->style()->flowThread().isEmpty())
         return true;
-    if (toElement(renderer->node())->isInTopLayer())
+    if (toElement(renderer->node())->shouldBeReparentedUnderRenderView(renderer->style()))
         return true;
     return false;
 }
@@ -90,7 +90,16 @@
         return renderer->nextSibling();
 
     Element* element = m_node->isElementNode() ? toElement(m_node) : 0;
-    if (element && element->isInTopLayer()) {
+    if (element && element->shouldBeReparentedUnderRenderView(m_style.get())) {
+        // FIXME: Reparented renderers not in the top layer should probably be
+        // ordered in DOM tree order. We don't have a good way to do that yet,
+        // since NodeRenderingTraversal isn't aware of reparenting. It's safe to
+        // just append for now; it doesn't disrupt the top layer rendering as
+        // the layer collection in RenderLayer only requires that top layer
+        // renderers are orderered correctly relative to each other.
+        if (!element->isInTopLayer())
+            return 0;
+
         const Vector<RefPtr<Element> >& topLayerElements = element->document()->topLayerElements();
         size_t position = topLayerElements.find(element);
         ASSERT(position != notFound);
@@ -123,10 +132,10 @@
     if (RenderObject* renderer = m_node->renderer())
         return renderer->previousSibling();
 
-    // FIXME: This doesn't work correctly for things in the top layer that are
+    // FIXME: This doesn't work correctly for reparented elements that are
     // display: none. We'd need to duplicate the logic in nextRenderer, but since
     // nothing needs that yet just assert.
-    ASSERT(!m_node->isElementNode() || !toElement(m_node)->isInTopLayer());
+    ASSERT(!m_node->isElementNode() || !toElement(m_node)->shouldBeReparentedUnderRenderView(m_style.get()));
 
     if (m_parentFlowRenderer)
         return m_parentFlowRenderer->previousRendererForNode(m_node);
@@ -147,8 +156,8 @@
     if (RenderObject* renderer = m_node->renderer())
         return renderer->parent();
 
-    if (m_node->isElementNode() && toElement(m_node)->isInTopLayer()) {
-        // The parent renderer of top layer elements is the RenderView, but only
+    if (m_node->isElementNode() && toElement(m_node)->shouldBeReparentedUnderRenderView(m_style.get())) {
+        // The parent renderer of reparented elements is the RenderView, but only
         // if the normal parent would have had a renderer.
         // FIXME: This behavior isn't quite right as the spec for top layer
         // only talks about display: none ancestors so putting a <dialog> inside
diff --git a/Source/core/dom/NodeRenderingTraversal.cpp b/Source/core/dom/NodeRenderingTraversal.cpp
index 97a4878..1b23181 100644
--- a/Source/core/dom/NodeRenderingTraversal.cpp
+++ b/Source/core/dom/NodeRenderingTraversal.cpp
@@ -27,8 +27,8 @@
 #include "config.h"
 #include "core/dom/NodeRenderingTraversal.h"
 
-#include "core/dom/ComposedShadowTreeWalker.h"
 #include "core/dom/PseudoElement.h"
+#include "core/dom/shadow/ComposedShadowTreeWalker.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NodeRenderingTraversal.h b/Source/core/dom/NodeRenderingTraversal.h
index 3d7fa11..6fb020d 100644
--- a/Source/core/dom/NodeRenderingTraversal.h
+++ b/Source/core/dom/NodeRenderingTraversal.h
@@ -93,8 +93,11 @@
 inline Node* nextSibling(const Node* node)
 {
     if (!node->needsShadowTreeWalker()) {
-        ASSERT(nextSiblingSlow(node) == node->nextSibling());
-        return node->nextSibling();
+        Node* next = node->nextSibling();
+        if (!next || !next->isInsertionPoint()) {
+            ASSERT(nextSiblingSlow(node) == next);
+            return next;
+        }
     }
 
     return nextSiblingSlow(node);
@@ -103,8 +106,11 @@
 inline Node* previousSibling(const Node* node)
 {
     if (!node->needsShadowTreeWalker()) {
-        ASSERT(previousSiblingSlow(node) == node->previousSibling());
-        return node->previousSibling();
+        Node* prev = node->previousSibling();
+        if (!prev || !prev->isInsertionPoint()) {
+            ASSERT(previousSiblingSlow(node) == prev);
+            return prev;
+        }
     }
 
     return previousSiblingSlow(node);
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp
index 49d9d93..d65ca0f 100644
--- a/Source/core/dom/ProcessingInstruction.cpp
+++ b/Source/core/dom/ProcessingInstruction.cpp
@@ -69,7 +69,7 @@
         document()->styleSheetCollection()->removeStyleSheetCandidateNode(this);
 }
 
-void ProcessingInstruction::setData(const String& data, ExceptionCode&)
+void ProcessingInstruction::setData(const String& data)
 {
     int oldLength = m_data.length();
     m_data = data;
@@ -94,8 +94,7 @@
 
 void ProcessingInstruction::setNodeValue(const String& nodeValue, ExceptionCode& ec)
 {
-    // NO_MODIFICATION_ALLOWED_ERR: taken care of by setData()
-    setData(nodeValue, ec);
+    setData(nodeValue);
 }
 
 PassRefPtr<Node> ProcessingInstruction::cloneNode(bool /*deep*/)
diff --git a/Source/core/dom/ProcessingInstruction.h b/Source/core/dom/ProcessingInstruction.h
index a63c1b7..b24b4ef 100644
--- a/Source/core/dom/ProcessingInstruction.h
+++ b/Source/core/dom/ProcessingInstruction.h
@@ -38,7 +38,7 @@
 
     const String& target() const { return m_target; }
     const String& data() const { return m_data; }
-    void setData(const String&, ExceptionCode&);
+    void setData(const String&);
 
     void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
 
diff --git a/Source/core/dom/ProcessingInstruction.idl b/Source/core/dom/ProcessingInstruction.idl
index 03530e2..1767ee5 100644
--- a/Source/core/dom/ProcessingInstruction.idl
+++ b/Source/core/dom/ProcessingInstruction.idl
@@ -23,7 +23,7 @@
     // DOM Level 1
 
     [TreatReturnedNullStringAs=Null] readonly attribute DOMString target;
-             [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException] attribute DOMString data;
+             [TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString data;
 
     // interface LinkStyle from DOM Level 2 Style Sheets
     readonly attribute StyleSheet sheet;
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 125cab1..311660d 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -804,7 +804,7 @@
         ASSERT(endOffset <= static_cast<ProcessingInstruction*>(container)->data().length());
         if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) {
             RefPtr<ProcessingInstruction> c = static_pointer_cast<ProcessingInstruction>(container->cloneNode(true));
-            c->setData(c->data().substring(startOffset, endOffset - startOffset), ec);
+            c->setData(c->data().substring(startOffset, endOffset - startOffset));
             if (fragment) {
                 result = fragment;
                 result->appendChild(c.release(), ec);
@@ -815,7 +815,7 @@
             ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(container);
             String data(pi->data());
             data.remove(startOffset, endOffset - startOffset);
-            pi->setData(data, ec);
+            pi->setData(data);
         }
         break;
     case Node::ELEMENT_NODE:
@@ -1807,7 +1807,11 @@
     unsigned boundaryOffset = boundary.offset();
     if (boundaryOffset <= oldNode->length())
         return;
-    boundary.set(oldNode->nextSibling(), boundaryOffset - oldNode->length(), 0);
+    Node* next = oldNode->nextSibling();
+    if (!next || !next->isTextNode())
+        boundary.set(oldNode, oldNode->length(), 0);
+    else
+        boundary.set(next, std::min(boundaryOffset - oldNode->length(), toText(next)->length()), 0);
 }
 
 void Range::textNodeSplit(Text* oldNode)
@@ -1816,8 +1820,6 @@
     ASSERT(oldNode->document() == m_ownerDocument);
     ASSERT(oldNode->parentNode());
     ASSERT(oldNode->isTextNode());
-    ASSERT(oldNode->nextSibling());
-    ASSERT(oldNode->nextSibling()->isTextNode());
     boundaryTextNodesSplit(m_start, oldNode);
     boundaryTextNodesSplit(m_end, oldNode);
 }
diff --git a/Source/core/dom/ScriptElement.cpp b/Source/core/dom/ScriptElement.cpp
index a70eedb..6b58738 100644
--- a/Source/core/dom/ScriptElement.cpp
+++ b/Source/core/dom/ScriptElement.cpp
@@ -52,7 +52,7 @@
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/MIMETypeRegistry.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #if ENABLE(SVG)
 #include "SVGNames.h"
diff --git a/Source/core/dom/SecurityContext.cpp b/Source/core/dom/SecurityContext.cpp
index 2c3d18f..cfaeacd2 100644
--- a/Source/core/dom/SecurityContext.cpp
+++ b/Source/core/dom/SecurityContext.cpp
@@ -31,7 +31,7 @@
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/page/ContentSecurityPolicy.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 71721f2..21cb569 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -25,7 +25,7 @@
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/rendering/RenderCombineText.h"
 #include "core/rendering/RenderText.h"
 
@@ -148,7 +148,7 @@
     return result.toString();
 }
 
-PassRefPtr<Text> Text::replaceWholeText(const String& newText, ExceptionCode&)
+PassRefPtr<Text> Text::replaceWholeText(const String& newText)
 {
     // Remove all adjacent text nodes, and replace the contents of this one.
 
diff --git a/Source/core/dom/Text.h b/Source/core/dom/Text.h
index d70c2c4..10fc820 100644
--- a/Source/core/dom/Text.h
+++ b/Source/core/dom/Text.h
@@ -44,7 +44,7 @@
     // DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1312295772
 
     String wholeText() const;
-    PassRefPtr<Text> replaceWholeText(const String&, ExceptionCode&);
+    PassRefPtr<Text> replaceWholeText(const String&);
     
     void recalcTextStyle(StyleChange);
     void createTextRendererIfNeeded();
diff --git a/Source/core/dom/Text.idl b/Source/core/dom/Text.idl
index 10c9af9..a86f063 100644
--- a/Source/core/dom/Text.idl
+++ b/Source/core/dom/Text.idl
@@ -29,7 +29,7 @@
 
     // Introduced in DOM Level 3:
     readonly attribute DOMString       wholeText;
-    [RaisesException] Text               replaceWholeText([Default=Undefined] optional DOMString content);
+    Text                               replaceWholeText([Default=Undefined] optional DOMString content);
     // ShadowAware API
     [ImplementedAs=insertionParentForBinding, PerWorldBindings] readonly attribute Node webkitInsertionParent;
 
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index 851371f..3087be8 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -34,13 +34,13 @@
 #include "core/dom/EventPathWalker.h"
 #include "core/dom/IdTargetObserverRegistry.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/TreeScopeAdopter.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/html/HTMLLabelElement.h"
 #include "core/html/HTMLMapElement.h"
-#include "core/html/shadow/InsertionPoint.h"
 #include "core/page/DOMSelection.h"
 #include "core/page/DOMWindow.h"
 #include "core/page/FocusController.h"
diff --git a/Source/core/dom/TreeScopeAdopter.cpp b/Source/core/dom/TreeScopeAdopter.cpp
index bd0911f..cd36f11 100644
--- a/Source/core/dom/TreeScopeAdopter.cpp
+++ b/Source/core/dom/TreeScopeAdopter.cpp
@@ -28,10 +28,10 @@
 #include "core/dom/Attr.h"
 #include "core/dom/Document.h"
 #include "core/dom/ElementRareData.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/NodeRareData.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/rendering/style/RenderStyle.h"
 
 namespace WebCore {
diff --git a/Source/core/dom/ComposedShadowTreeWalker.cpp b/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp
similarity index 97%
rename from Source/core/dom/ComposedShadowTreeWalker.cpp
rename to Source/core/dom/shadow/ComposedShadowTreeWalker.cpp
index 7b9ff2a..1c4f81f 100644
--- a/Source/core/dom/ComposedShadowTreeWalker.cpp
+++ b/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp
@@ -26,15 +26,15 @@
  */
 
 #include "config.h"
-#include "core/dom/ComposedShadowTreeWalker.h"
+#include "core/dom/shadow/ComposedShadowTreeWalker.h"
 
 #include "core/dom/Element.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/PseudoElement.h"
-#include "core/html/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/InsertionPoint.h"
 #include "core/html/shadow/HTMLContentElement.h"
 #include "core/html/shadow/HTMLShadowElement.h"
-#include "core/html/shadow/InsertionPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ComposedShadowTreeWalker.h b/Source/core/dom/shadow/ComposedShadowTreeWalker.h
similarity index 98%
rename from Source/core/dom/ComposedShadowTreeWalker.h
rename to Source/core/dom/shadow/ComposedShadowTreeWalker.h
index 1fd2aaa..d93d378 100644
--- a/Source/core/dom/ComposedShadowTreeWalker.h
+++ b/Source/core/dom/shadow/ComposedShadowTreeWalker.h
@@ -28,8 +28,8 @@
 #define ComposedShadowTreeWalker_h
 
 #include "core/dom/NodeRenderingTraversal.h"
-#include "core/dom/ShadowRoot.h"
-#include "core/html/shadow/InsertionPoint.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/ContentDistributor.cpp b/Source/core/dom/shadow/ContentDistributor.cpp
similarity index 98%
rename from Source/core/html/shadow/ContentDistributor.cpp
rename to Source/core/dom/shadow/ContentDistributor.cpp
index fac9537..70f6d5b 100644
--- a/Source/core/html/shadow/ContentDistributor.cpp
+++ b/Source/core/dom/shadow/ContentDistributor.cpp
@@ -25,12 +25,12 @@
  */
 
 #include "config.h"
-#include "core/html/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ContentDistributor.h"
 
-#include "core/dom/ElementShadow.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ShadowRoot.h"
-#include "core/html/shadow/ContentSelectorQuery.h"
+#include "core/dom/shadow/ContentSelectorQuery.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/shadow/HTMLContentElement.h"
 #include "core/html/shadow/HTMLShadowElement.h"
 
diff --git a/Source/core/html/shadow/ContentDistributor.h b/Source/core/dom/shadow/ContentDistributor.h
similarity index 96%
rename from Source/core/html/shadow/ContentDistributor.h
rename to Source/core/dom/shadow/ContentDistributor.h
index 1d3e657..91a480c 100644
--- a/Source/core/html/shadow/ContentDistributor.h
+++ b/Source/core/dom/shadow/ContentDistributor.h
@@ -31,11 +31,11 @@
 #ifndef ContentDistributor_h
 #define ContentDistributor_h
 
-#include "core/html/shadow/SelectRuleFeatureSet.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "core/dom/shadow/SelectRuleFeatureSet.h"
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
@@ -151,7 +151,7 @@
 
     HashMap<const Node*, RefPtr<InsertionPoint> > m_nodeToInsertionPoint;
     SelectRuleFeatureSet m_selectFeatures;
-    bool m_needsSelectFeatureSet : 1;
+    unsigned m_needsSelectFeatureSet : 1;
     unsigned m_validity : 2;
 };
 
diff --git a/Source/core/html/shadow/ContentSelectorQuery.cpp b/Source/core/dom/shadow/ContentSelectorQuery.cpp
similarity index 95%
rename from Source/core/html/shadow/ContentSelectorQuery.cpp
rename to Source/core/dom/shadow/ContentSelectorQuery.cpp
index 418e159..17c5aae 100644
--- a/Source/core/html/shadow/ContentSelectorQuery.cpp
+++ b/Source/core/dom/shadow/ContentSelectorQuery.cpp
@@ -25,13 +25,13 @@
  */
 
 #include "config.h"
-#include "core/html/shadow/ContentSelectorQuery.h"
+#include "core/dom/shadow/ContentSelectorQuery.h"
 
 #include "core/css/CSSSelectorList.h"
 #include "core/css/SelectorChecker.h"
 #include "core/css/SiblingTraversalStrategies.h"
-#include "core/dom/ShadowRoot.h"
-#include "core/html/shadow/InsertionPoint.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/ContentSelectorQuery.h b/Source/core/dom/shadow/ContentSelectorQuery.h
similarity index 97%
rename from Source/core/html/shadow/ContentSelectorQuery.h
rename to Source/core/dom/shadow/ContentSelectorQuery.h
index b86098d..fd7cd82 100644
--- a/Source/core/html/shadow/ContentSelectorQuery.h
+++ b/Source/core/dom/shadow/ContentSelectorQuery.h
@@ -34,8 +34,8 @@
 #include "core/css/CSSSelectorList.h"
 #include "core/css/SelectorChecker.h"
 #include "core/dom/SelectorQuery.h"
-#include <wtf/Forward.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ElementShadow.cpp b/Source/core/dom/shadow/ElementShadow.cpp
similarity index 98%
rename from Source/core/dom/ElementShadow.cpp
rename to Source/core/dom/shadow/ElementShadow.cpp
index 9fe6b93..f40edc3 100644
--- a/Source/core/dom/ElementShadow.cpp
+++ b/Source/core/dom/shadow/ElementShadow.cpp
@@ -25,7 +25,7 @@
  */
 
 #include "config.h"
-#include "core/dom/ElementShadow.h"
+#include "core/dom/shadow/ElementShadow.h"
 
 #include "core/dom/ContainerNodeAlgorithms.h"
 #include "core/inspector/InspectorInstrumentation.h"
diff --git a/Source/core/dom/ElementShadow.h b/Source/core/dom/shadow/ElementShadow.h
similarity index 92%
rename from Source/core/dom/ElementShadow.h
rename to Source/core/dom/shadow/ElementShadow.h
index 3276f65..914471b 100644
--- a/Source/core/dom/ElementShadow.h
+++ b/Source/core/dom/shadow/ElementShadow.h
@@ -28,18 +28,18 @@
 #define ElementShadow_h
 
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ShadowRoot.h"
-#include "core/html/shadow/ContentDistributor.h"
-#include <wtf/DoublyLinkedList.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Vector.h>
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "wtf/DoublyLinkedList.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
 class ElementShadow {
-   WTF_MAKE_NONCOPYABLE(ElementShadow); WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_NONCOPYABLE(ElementShadow); WTF_MAKE_FAST_ALLOCATED;
 public:
     static PassOwnPtr<ElementShadow> create()
     {
diff --git a/Source/core/html/shadow/InsertionPoint.cpp b/Source/core/dom/shadow/InsertionPoint.cpp
similarity index 98%
rename from Source/core/html/shadow/InsertionPoint.cpp
rename to Source/core/dom/shadow/InsertionPoint.cpp
index b3608d6..8e905c7 100644
--- a/Source/core/html/shadow/InsertionPoint.cpp
+++ b/Source/core/dom/shadow/InsertionPoint.cpp
@@ -29,13 +29,13 @@
  */
 
 #include "config.h"
-#include "core/html/shadow/InsertionPoint.h"
+#include "core/dom/shadow/InsertionPoint.h"
 
 #include "HTMLNames.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/QualifiedName.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/StaticNodeList.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/InsertionPoint.h b/Source/core/dom/shadow/InsertionPoint.h
similarity index 97%
rename from Source/core/html/shadow/InsertionPoint.h
rename to Source/core/dom/shadow/InsertionPoint.h
index 587ef2e..cbc5afb 100644
--- a/Source/core/html/shadow/InsertionPoint.h
+++ b/Source/core/dom/shadow/InsertionPoint.h
@@ -33,11 +33,11 @@
 
 #include "HTMLNames.h"
 #include "core/css/CSSSelectorList.h"
-#include "core/dom/ElementShadow.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLElement.h"
-#include "core/html/shadow/ContentDistributor.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/SelectRuleFeatureSet.cpp b/Source/core/dom/shadow/SelectRuleFeatureSet.cpp
similarity index 98%
rename from Source/core/html/shadow/SelectRuleFeatureSet.cpp
rename to Source/core/dom/shadow/SelectRuleFeatureSet.cpp
index 2a38adc..4f6f526 100644
--- a/Source/core/html/shadow/SelectRuleFeatureSet.cpp
+++ b/Source/core/dom/shadow/SelectRuleFeatureSet.cpp
@@ -29,7 +29,7 @@
  */
 
 #include "config.h"
-#include "core/html/shadow/SelectRuleFeatureSet.h"
+#include "core/dom/shadow/SelectRuleFeatureSet.h"
 
 #include "core/css/CSSSelector.h"
 
diff --git a/Source/core/html/shadow/SelectRuleFeatureSet.h b/Source/core/dom/shadow/SelectRuleFeatureSet.h
similarity index 100%
rename from Source/core/html/shadow/SelectRuleFeatureSet.h
rename to Source/core/dom/shadow/SelectRuleFeatureSet.h
diff --git a/Source/core/dom/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp
similarity index 97%
rename from Source/core/dom/ShadowRoot.cpp
rename to Source/core/dom/shadow/ShadowRoot.cpp
index 47d3eb0..7c0aad9 100644
--- a/Source/core/dom/ShadowRoot.cpp
+++ b/Source/core/dom/shadow/ShadowRoot.cpp
@@ -25,15 +25,15 @@
  */
 
 #include "config.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 
-#include "core/css/resolver/StyleResolver.h"
-#include "core/dom/ElementShadow.h"
-#include "core/dom/Text.h"
-#include "core/editing/markup.h"
-#include "core/html/shadow/ContentDistributor.h"
-#include "core/html/shadow/InsertionPoint.h"
 #include "RuntimeEnabledFeatures.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/Text.h"
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/editing/markup.h"
 #include "core/platform/HistogramSupport.h"
 
 namespace WebCore {
diff --git a/Source/core/dom/ShadowRoot.h b/Source/core/dom/shadow/ShadowRoot.h
similarity index 99%
rename from Source/core/dom/ShadowRoot.h
rename to Source/core/dom/shadow/ShadowRoot.h
index ce1ce4c..5188c4e 100644
--- a/Source/core/dom/ShadowRoot.h
+++ b/Source/core/dom/shadow/ShadowRoot.h
@@ -33,7 +33,7 @@
 #include "core/dom/Element.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/TreeScope.h"
-#include <wtf/DoublyLinkedList.h>
+#include "wtf/DoublyLinkedList.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ShadowRoot.idl b/Source/core/dom/shadow/ShadowRoot.idl
similarity index 98%
rename from Source/core/dom/ShadowRoot.idl
rename to Source/core/dom/shadow/ShadowRoot.idl
index 9fe8551..34190bc 100644
--- a/Source/core/dom/ShadowRoot.idl
+++ b/Source/core/dom/shadow/ShadowRoot.idl
@@ -34,7 +34,7 @@
     [TreatNullAs=NullString, DeliverCustomElementCallbacks, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds, SetterRaisesException] attribute DOMString innerHTML;
 
     [RaisesException] Node cloneNode([Default=Undefined] optional boolean deep);
-    DOMSelection getSelection();
+    Selection getSelection();
     Element getElementById([Default=Undefined] optional DOMString elementId);
     NodeList getElementsByClassName([Default=Undefined] optional DOMString className);
     NodeList getElementsByTagName([Default=Undefined] optional DOMString tagName);
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index b006a9a..868e60a 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -427,8 +427,10 @@
         if ((node->hasTagName(styleTag) && !(toElement(node.get())->hasAttribute(scopedAttr))) || node->hasTagName(linkTag)) {
             nextNode = NodeTraversal::nextSkippingChildren(node.get());
             RefPtr<ContainerNode> rootEditableElement = node->rootEditableElement();
-            removeNode(node);
-            appendNode(node, rootEditableElement);
+            if (rootEditableElement.get()) {
+                removeNode(node);
+                appendNode(node, rootEditableElement);
+            }
         }
         node = nextNode;
     }
@@ -731,30 +733,6 @@
     m_leadingWhitespace.clear();
     m_trailingWhitespace.clear();
 }
-    
-String DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection()
-{
-    if (!m_selectionToDelete.isRange())
-        return String();
-
-    VisiblePosition startOfSelection = m_selectionToDelete.start();
-    if (!isStartOfWord(startOfSelection))
-        return String();
-
-    VisiblePosition nextPosition = startOfSelection.next();
-    if (nextPosition.isNull())
-        return String();
-
-    RefPtr<Range> rangeOfFirstCharacter = Range::create(document(), startOfSelection.deepEquivalent(), nextPosition.deepEquivalent());
-    Vector<DocumentMarker*> markers = document()->markers()->markersInRange(rangeOfFirstCharacter.get(), DocumentMarker::Autocorrected);
-    for (size_t i = 0; i < markers.size(); ++i) {
-        const DocumentMarker* marker = markers[i];
-        int startOffset = marker->startOffset();
-        if (startOffset == startOfSelection.deepEquivalent().offsetInContainerNode())
-            return marker->description();
-    }
-    return String();
-}
 
 // This method removes div elements with no attributes that have only one child or no children at all.
 void DeleteSelectionCommand::removeRedundantBlocks()
@@ -784,8 +762,6 @@
     if (!m_selectionToDelete.isNonOrphanedRange())
         return;
 
-    String originalString = originalStringForAutocorrectionAtBeginningOfSelection();
-
     // save this to later make the selection with
     EAffinity affinity = m_selectionToDelete.affinity();
     
diff --git a/Source/core/editing/DeleteSelectionCommand.h b/Source/core/editing/DeleteSelectionCommand.h
index 08a93e8..735e957 100644
--- a/Source/core/editing/DeleteSelectionCommand.h
+++ b/Source/core/editing/DeleteSelectionCommand.h
@@ -70,9 +70,6 @@
     virtual void deleteTextFromNode(PassRefPtr<Text>, unsigned, unsigned);
     void removeRedundantBlocks();
 
-    // This function provides access to original string after the correction has been deleted.
-    String originalStringForAutocorrectionAtBeginningOfSelection();
-
     bool m_hasSelectionToDelete;
     bool m_smartDelete;
     bool m_mergeBlocksAfterDelete;
diff --git a/Source/core/editing/DictationAlternative.cpp b/Source/core/editing/DictationAlternative.cpp
deleted file mode 100644
index 8ed7161..0000000
--- a/Source/core/editing/DictationAlternative.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/editing/DictationAlternative.h"
-
-namespace WebCore {
-
-DictationAlternative::DictationAlternative(unsigned start, unsigned length, uint64_t context)
-    : rangeStart(start)
-    , rangeLength(length)
-    , dictationContext(context)
-{
-}
-    
-DictationAlternative::DictationAlternative()
-    : rangeStart(0)
-    , rangeLength(0)
-    , dictationContext(0)
-{
-}
-
-}
diff --git a/Source/core/editing/DictationAlternative.h b/Source/core/editing/DictationAlternative.h
deleted file mode 100644
index 08fcea3..0000000
--- a/Source/core/editing/DictationAlternative.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DictationAlternative_h
-#define DictationAlternative_h
-
-#include <stdint.h>
-
-namespace WebCore {
-struct DictationAlternative {
-    DictationAlternative(unsigned start, unsigned length, uint64_t context);
-    DictationAlternative();
-    unsigned rangeStart;
-    unsigned rangeLength;
-
-    // This need to be 64 bit becauese it actually holds a pointer in WebKit.
-    uint64_t dictationContext;
-};
-
-}
-
-#endif // DictationAlternative_h
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
index 96fe750..733cc6c 100644
--- a/Source/core/editing/Editor.cpp
+++ b/Source/core/editing/Editor.cpp
@@ -44,14 +44,13 @@
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeList.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
 #include "core/dom/TextEvent.h"
 #include "core/dom/UserTypingGestureIndicator.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/ApplyStyleCommand.h"
 #include "core/editing/CreateLinkCommand.h"
 #include "core/editing/DeleteSelectionCommand.h"
-#include "core/editing/DictationAlternative.h"
 #include "core/editing/IndentOutdentCommand.h"
 #include "core/editing/InsertListCommand.h"
 #include "core/editing/ModifySelectionListLevel.h"
@@ -1456,8 +1455,6 @@
         }
     } else {
         misspelledWord = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
-
-#if USE(GRAMMAR_CHECKING)
         grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
         if (!misspelledWord.isEmpty()) {
             // Stop looking at start of next misspelled word
@@ -1468,7 +1465,6 @@
     
         if (isGrammarCheckingEnabled())
             badGrammarPhrase = TextCheckingHelper(client(), grammarSearchRange).findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
-#endif
     }
     
     // If we found neither bad grammar nor a misspelled word, wrap and try again (but don't bother if we started at the beginning of the
@@ -1490,8 +1486,6 @@
             }
         } else {
             misspelledWord = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
-
-#if USE(GRAMMAR_CHECKING)
             grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
             if (!misspelledWord.isEmpty()) {
                 // Stop looking at start of next misspelled word
@@ -1502,12 +1496,10 @@
 
             if (isGrammarCheckingEnabled())
                 badGrammarPhrase = TextCheckingHelper(client(), grammarSearchRange).findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
-#endif
         }
     }
     
     if (!badGrammarPhrase.isEmpty()) {
-        ASSERT(WTF_USE_GRAMMAR_CHECKING);
         // We found bad grammar. Since we only searched for bad grammar up to the first misspelled word, the bad grammar
         // takes precedence and we ignore any potential misspelled word. Select the grammar detail, update the spelling
         // panel, and store a marker so we draw the green squiggle later.
@@ -1590,20 +1582,15 @@
 
 bool Editor::isSelectionUngrammatical()
 {
-#if USE(GRAMMAR_CHECKING)
     Vector<String> ignoredGuesses;
     RefPtr<Range> range = frame()->selection()->toNormalizedRange();
     if (!range)
         return false;
     return TextCheckingHelper(client(), range).isUngrammatical(ignoredGuesses);
-#else
-    return false;
-#endif
 }
 
 Vector<String> Editor::guessesForUngrammaticalSelection()
 {
-#if USE(GRAMMAR_CHECKING)
     Vector<String> guesses;
     RefPtr<Range> range = frame()->selection()->toNormalizedRange();
     if (!range)
@@ -1611,9 +1598,6 @@
     // Ignore the result of isUngrammatical; we just want the guesses, whether or not there are any
     TextCheckingHelper(client(), range).isUngrammatical(guesses);
     return guesses;
-#else
-    return Vector<String>();
-#endif
 }
 
 Vector<String> Editor::guessesForMisspelledOrUngrammatical(bool& misspelled, bool& ungrammatical)
@@ -1685,7 +1669,7 @@
         if (isContinuousSpellCheckingEnabled())
             textCheckingOptions |= TextCheckingTypeSpelling;
 
-        if (!(textCheckingOptions & (TextCheckingTypeSpelling | TextCheckingTypeReplacement)))
+        if (!(textCheckingOptions & TextCheckingTypeSpelling))
             return;
 
         if (isGrammarCheckingEnabled())
@@ -1769,11 +1753,8 @@
     TextCheckingHelper checker(client(), searchRange);
     if (checkSpelling)
         checker.markAllMisspellings(firstMisspellingRange);
-    else {
-        ASSERT(WTF_USE_GRAMMAR_CHECKING);
-        if (isGrammarCheckingEnabled())
-            checker.markAllBadGrammar();
-    }    
+    else if (isGrammarCheckingEnabled())
+        checker.markAllBadGrammar();
 }
 
 bool Editor::isSpellCheckingEnabledFor(Node* node) const
@@ -1798,7 +1779,6 @@
     
 void Editor::markBadGrammar(const VisibleSelection& selection)
 {
-    ASSERT(WTF_USE_GRAMMAR_CHECKING);
     RefPtr<Range> firstMisspellingRange;
     markMisspellingsOrBadGrammar(selection, false, firstMisspellingRange);
 }
@@ -1809,7 +1789,6 @@
     ASSERT(unifiedTextCheckerEnabled());
 
     bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
-    bool shouldShowCorrectionPanel = textCheckingOptions & TextCheckingTypeShowCorrectionPanel;
 
     // This function is called with selections already expanded to word boundaries.
     if (!client() || !spellingRange || (shouldMarkGrammar && !grammarRange))
@@ -1829,7 +1808,7 @@
         return;
     RefPtr<Range> paragraphRange = paragraphToCheck.paragraphRange();
 
-    bool asynchronous = m_frame && m_frame->settings() && m_frame->settings()->asynchronousSpellCheckingEnabled() && !shouldShowCorrectionPanel;
+    bool asynchronous = m_frame && m_frame->settings() && m_frame->settings()->asynchronousSpellCheckingEnabled();
 
     // In asynchronous mode, we intentionally check paragraph-wide sentence.
     RefPtr<SpellCheckRequest> request = SpellCheckRequest::create(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessIncremental, asynchronous ? paragraphRange : rangeToCheck, paragraphRange);
@@ -1854,10 +1833,6 @@
 
     bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
     bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
-    bool shouldMarkLink = textCheckingOptions & TextCheckingTypeLink;
-    bool shouldPerformReplacement = textCheckingOptions & TextCheckingTypeReplacement;
-    bool shouldShowCorrectionPanel = textCheckingOptions & TextCheckingTypeShowCorrectionPanel;
-    bool shouldCheckForCorrection = shouldShowCorrectionPanel || (textCheckingOptions & TextCheckingTypeCorrection);
 
     // Expand the range to encompass entire paragraphs, since text checking needs that much context.
     int selectionOffset = 0;
@@ -1866,7 +1841,7 @@
     bool restoreSelectionAfterChange = false;
     bool adjustSelectionForParagraphBoundaries = false;
 
-    if (shouldPerformReplacement || shouldMarkSpelling || shouldCheckForCorrection) {
+    if (shouldMarkSpelling) {
         if (m_frame->selection()->selectionType() == VisibleSelection::CaretSelection) {
             // Attempt to save the caret position so we can restore it later if needed
             Position caretPosition = m_frame->selection()->end();
@@ -1879,16 +1854,10 @@
         }
     }
 
-    // If this checking is only for showing correction panel, we shouldn't bother to mark misspellings.
-    if (shouldShowCorrectionPanel)
-        shouldMarkSpelling = false;
-
-    int offsetDueToReplacement = 0;
-
     for (unsigned i = 0; i < results.size(); i++) {
-        int spellingRangeEndOffset = paragraph.checkingEnd() + offsetDueToReplacement;
+        int spellingRangeEndOffset = paragraph.checkingEnd();
         const TextCheckingResult* result = &results[i];
-        int resultLocation = result->location + offsetDueToReplacement;
+        int resultLocation = result->location;
         int resultLength = result->length;
         bool resultEndsAtAmbiguousBoundary = ambiguousBoundaryOffset >= 0 && resultLocation + resultLength == ambiguousBoundaryOffset;
 
@@ -1911,87 +1880,6 @@
                     badGrammarRange->startContainer()->document()->markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription, result->hash);
                 }
             }
-        } else if (resultLocation + resultLength <= spellingRangeEndOffset && resultLocation + resultLength >= paragraph.checkingStart()
-                    && (result->type == TextCheckingTypeLink
-                    || result->type == TextCheckingTypeQuote
-                    || result->type == TextCheckingTypeDash
-                    || result->type == TextCheckingTypeReplacement
-                    || result->type == TextCheckingTypeCorrection)) {
-            // In this case the result range just has to touch the spelling range, so we can handle replacing non-word text such as punctuation.
-            ASSERT(resultLength > 0 && resultLocation >= 0);
-
-            if (shouldShowCorrectionPanel && (resultLocation + resultLength < spellingRangeEndOffset || result->type != TextCheckingTypeCorrection))
-                continue;
-
-            int replacementLength = result->replacement.length();
-
-            // Apply replacement if:
-            // 1. The replacement length is non-zero.
-            // 2. The result doesn't end at an ambiguous boundary.
-            //    (FIXME: this is required until 6853027 is fixed and text checking can do this for us
-            bool doReplacement = replacementLength > 0 && !resultEndsAtAmbiguousBoundary;
-            RefPtr<Range> rangeToReplace = paragraph.subrange(resultLocation, resultLength);
-            VisibleSelection selectionToReplace(rangeToReplace.get(), DOWNSTREAM);
-
-            // adding links should be done only immediately after they are typed
-            int resultEnd = resultLocation + resultLength;
-            if (result->type == TextCheckingTypeLink
-                && (selectionOffset > resultEnd + 1 || selectionOffset <= resultLocation))
-                continue;
-
-            if (!(shouldPerformReplacement || shouldCheckForCorrection || shouldMarkLink) || !doReplacement)
-                continue;
-
-            String replacedString = plainText(rangeToReplace.get());
-
-            if (shouldShowCorrectionPanel) {
-                ASSERT_NOT_REACHED();
-
-                // shouldShowCorrectionPanel can be true only when the panel is available.
-                if (resultLocation + resultLength == spellingRangeEndOffset) {
-                    // We only show the correction panel on the last word.
-                    break;
-                }
-                // If this function is called for showing correction panel, we ignore other correction or replacement.
-                continue;
-            }
-
-            if (selectionToReplace != m_frame->selection()->selection()) {
-                if (!m_frame->selection()->shouldChangeSelection(selectionToReplace))
-                    continue;
-            }
-
-            if (result->type == TextCheckingTypeLink) {
-                m_frame->selection()->setSelection(selectionToReplace);
-                selectionChanged = true;
-                restoreSelectionAfterChange = false;
-                if (canEditRichly())
-                    applyCommand(CreateLinkCommand::create(m_frame->document(), result->replacement));
-            } else if (canEdit() && shouldInsertText(result->replacement, rangeToReplace.get(), EditorInsertActionTyped)) {
-                Node* root = paragraph.paragraphRange()->startContainer();
-                while (ContainerNode* parent = root->parentNode())
-                    root = parent;
-
-                int paragraphStartIndex = TextIterator::rangeLength(Range::create(m_frame->document(), root, 0, paragraph.paragraphRange()->startContainer(), paragraph.paragraphRange()->startOffset()).get());
-                int paragraphLength = TextIterator::rangeLength(paragraph.paragraphRange().get());
-                applyCommand(SpellingCorrectionCommand::create(rangeToReplace, result->replacement));
-                // Recalculate newParagraphRange, since SpellingCorrectionCommand modifies the DOM, such that the original paragraph range is no longer valid. Radar: 10305315 Bugzilla: 89526
-                RefPtr<Range> newParagraphRange = TextIterator::rangeFromLocationAndLength(toContainerNode(root), paragraphStartIndex, paragraphLength + replacementLength - resultLength);
-                paragraph = TextCheckingParagraph(TextIterator::subrange(newParagraphRange.get(), resultLocation, replacementLength), newParagraphRange);
-                
-                if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) {
-                    if (Element* root = m_frame->selection()->selection().rootEditableElement())
-                        cache->postNotification(root, AXObjectCache::AXAutocorrectionOccured, true);
-                }
-
-                selectionChanged = true;
-                offsetDueToReplacement += replacementLength - resultLength;
-                if (resultLocation < selectionOffset) {
-                    selectionOffset += replacementLength - resultLength;
-                    if (ambiguousBoundaryOffset >= 0)
-                        ambiguousBoundaryOffset = selectionOffset - 1;
-                }
-            }
         }
     }
 
@@ -2012,24 +1900,6 @@
     }
 }
 
-void Editor::changeBackToReplacedString(const String& replacedString)
-{
-    ASSERT(unifiedTextCheckerEnabled());
-
-    if (replacedString.isEmpty())
-        return;
-
-    RefPtr<Range> selection = selectedRange();
-    if (!shouldInsertText(replacedString, selection.get(), EditorInsertActionPasted))
-        return;
-    
-    TextCheckingParagraph paragraph(selection);
-    replaceSelectionWithText(replacedString, false, false);
-    RefPtr<Range> changedRange = paragraph.subrange(paragraph.checkingStart(), replacedString.length());
-    changedRange->startContainer()->document()->markers()->addMarker(changedRange.get(), DocumentMarker::Replacement, String());
-}
-
-
 void Editor::markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection)
 {
     if (unifiedTextCheckerEnabled()) {
@@ -2116,8 +1986,7 @@
     Document* document = m_frame->document();
     RefPtr<Range> wordRange = Range::create(document, startOfFirstWord.deepEquivalent(), endOfLastWord.deepEquivalent());
 
-    document->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar | DocumentMarker::CorrectionIndicator | DocumentMarker::SpellCheckingExemption | DocumentMarker::DictationAlternatives, DocumentMarkerController::RemovePartiallyOverlappingMarker);
-    document->markers()->clearDescriptionOnMarkersIntersectingRange(wordRange.get(), DocumentMarker::Replacement);
+    document->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar, DocumentMarkerController::RemovePartiallyOverlappingMarker);
 }
 
 PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint)
@@ -2607,18 +2476,12 @@
 {
     bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
     bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
-    bool shouldShowCorrectionPanel = textCheckingOptions & TextCheckingTypeShowCorrectionPanel;
-    bool shouldCheckForCorrection = shouldShowCorrectionPanel || (textCheckingOptions & TextCheckingTypeCorrection);
 
     TextCheckingTypeMask checkingTypes = 0;
     if (shouldMarkSpelling)
         checkingTypes |= TextCheckingTypeSpelling;
     if (shouldMarkGrammar)
         checkingTypes |= TextCheckingTypeGrammar;
-    if (shouldCheckForCorrection)
-        checkingTypes |= TextCheckingTypeCorrection;
-    if (shouldShowCorrectionPanel)
-        checkingTypes |= TextCheckingTypeShowCorrectionPanel;
 
     return checkingTypes;
 }
diff --git a/Source/core/editing/Editor.h b/Source/core/editing/Editor.h
index ea94322..60eecf9 100644
--- a/Source/core/editing/Editor.h
+++ b/Source/core/editing/Editor.h
@@ -28,7 +28,6 @@
 
 #include "core/dom/ClipboardAccessPolicy.h"
 #include "core/dom/DocumentMarker.h"
-#include "core/editing/DictationAlternative.h"
 #include "core/editing/EditAction.h"
 #include "core/editing/EditingBehavior.h"
 #include "core/editing/EditingStyle.h"
@@ -221,7 +220,6 @@
     void toggleOverwriteModeEnabled() { m_overwriteModeEnabled = !m_overwriteModeEnabled; }
 
     void markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask, Range* spellingRange, Range* grammarRange);
-    void changeBackToReplacedString(const String& replacedString);
 
     void advanceToNextMisspelling(bool startBeforeSelection = false);
     void showSpellingGuessPanel();
diff --git a/Source/core/editing/FrameSelection.h b/Source/core/editing/FrameSelection.h
index 9cd0db1..5ea26a2 100644
--- a/Source/core/editing/FrameSelection.h
+++ b/Source/core/editing/FrameSelection.h
@@ -121,8 +121,7 @@
         ClearTypingStyle = 1 << 2,
         SpellCorrectionTriggered = 1 << 3,
         DoNotSetFocus = 1 << 4,
-        DictationTriggered = 1 << 5,
-        DoNotUpdateAppearance = 1 << 6,
+        DoNotUpdateAppearance = 1 << 5,
     };
     typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOption and EUserTriggered
     static inline EUserTriggered selectionOptionsToUserTriggered(SetSelectionOptions options)
diff --git a/Source/core/editing/TextCheckingHelper.cpp b/Source/core/editing/TextCheckingHelper.cpp
index 60dada5..3f73d04 100644
--- a/Source/core/editing/TextCheckingHelper.cpp
+++ b/Source/core/editing/TextCheckingHelper.cpp
@@ -42,8 +42,6 @@
 
 static void findBadGrammars(TextCheckerClient* client, const UChar* text, int start, int length, Vector<TextCheckingResult>& results)
 {
-    ASSERT(WTF_USE_GRAMMAR_CHECKING);
-
     int checkLocation = start;
     int checkLength = length;
 
@@ -413,7 +411,6 @@
 
 int TextCheckingHelper::findFirstGrammarDetail(const Vector<GrammarDetail>& grammarDetails, int badGrammarPhraseLocation, int /*badGrammarPhraseLength*/, int startOffset, int endOffset, bool markAll)
 {
-#if USE(GRAMMAR_CHECKING)
     // Found some bad grammar. Find the earliest detail range that starts in our search range (if any).
     // Optionally add a DocumentMarker for each detail in the range.
     int earliestDetailLocationSoFar = -1;
@@ -445,20 +442,10 @@
     }
     
     return earliestDetailIndex;
-#else
-    ASSERT_NOT_REACHED();
-    UNUSED_PARAM(grammarDetails);
-    UNUSED_PARAM(badGrammarPhraseLocation);
-    UNUSED_PARAM(startOffset);
-    UNUSED_PARAM(endOffset);
-    UNUSED_PARAM(markAll);
-    return 0;
-#endif
 }
 
 String TextCheckingHelper::findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarPhraseOffset, bool markAll)
 {
-    ASSERT(WTF_USE_GRAMMAR_CHECKING);
     // Initialize out parameters; these will be updated if we find something to return.
     outGrammarDetail.location = -1;
     outGrammarDetail.length = 0;
@@ -519,7 +506,6 @@
 
 bool TextCheckingHelper::isUngrammatical(Vector<String>& guessesVector) const
 {
-    ASSERT(WTF_USE_GRAMMAR_CHECKING);
     if (!m_client)
         return false;
 
@@ -620,7 +606,6 @@
 
 void TextCheckingHelper::markAllBadGrammar()
 {
-    ASSERT(WTF_USE_GRAMMAR_CHECKING);
     // Use the "markAll" feature of ofindFirstBadGrammar. Ignore the return value and "out parameters"; all we need to
     // do is mark every instance.
     GrammarDetail ignoredGrammarDetail;
diff --git a/Source/core/editing/TextCheckingHelper.h b/Source/core/editing/TextCheckingHelper.h
index 8eda3fc..e3e9734 100644
--- a/Source/core/editing/TextCheckingHelper.h
+++ b/Source/core/editing/TextCheckingHelper.h
@@ -44,7 +44,7 @@
     void expandRangeToNextEnd();
 
     int textLength() const { return text().length(); }
-    String textSubstring(unsigned pos, unsigned len = UINT_MAX) const { return text().substring(pos, len); }
+    String textSubstring(unsigned pos, unsigned len = INT_MAX) const { return text().substring(pos, len); }
     const UChar* textCharacters() const { return text().characters(); }
     UChar textCharAt(int index) const { return text()[static_cast<unsigned>(index)]; }
 
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index 2ef7b5e..be5e983 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -32,7 +32,7 @@
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Range.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/VisiblePosition.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
@@ -543,7 +543,7 @@
     }
     String str = renderer->text();
     unsigned start = m_offset;
-    unsigned end = (m_node == m_endContainer) ? static_cast<unsigned>(m_endOffset) : UINT_MAX;
+    unsigned end = (m_node == m_endContainer) ? static_cast<unsigned>(m_endOffset) : INT_MAX;
     while (m_textBox) {
         unsigned textBoxStart = m_textBox->start();
         unsigned runStart = max(textBoxStart, start);
@@ -1253,7 +1253,7 @@
     m_textLength = m_positionEndOffset - m_positionStartOffset;
     m_textCharacters = text.characters() + (m_positionStartOffset - offsetInNode);
     ASSERT(m_textCharacters >= text.characters());
-    ASSERT(m_textCharacters + m_textLength <= text.characters() + static_cast<int>(text.length()));
+    RELEASE_ASSERT(m_textCharacters + m_textLength <= text.characters() + static_cast<int>(text.length()));
 
     m_lastCharacter = text[m_positionEndOffset - 1];
 
diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp
index 241bd26..69a59f3 100644
--- a/Source/core/editing/htmlediting.cpp
+++ b/Source/core/editing/htmlediting.cpp
@@ -34,8 +34,8 @@
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/PositionIterator.h"
 #include "core/dom/Range.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/HTMLInterchange.h"
 #include "core/editing/TextIterator.h"
diff --git a/Source/core/features.gypi b/Source/core/features.gypi
index 68371d8..06d85c3 100644
--- a/Source/core/features.gypi
+++ b/Source/core/features.gypi
@@ -41,17 +41,14 @@
       'ENABLE_CSS_REGIONS=1',
       'ENABLE_CUSTOM_SCHEME_HANDLER=0',
       'ENABLE_ENCRYPTED_MEDIA=1',
-      'ENABLE_RESOLUTION_MEDIA_QUERY=0',
       'ENABLE_SVG=<(enable_svg)',
       'ENABLE_SVG_FONTS=<(enable_svg)',
       'ENABLE_TOUCH_ICON_LOADING=<(enable_touch_icon_loading)',
       'ENABLE_WEBGL=1',
       'ENABLE_XHR_TIMEOUT=0',
-      'WTF_USE_BUILTIN_UTF8_CODEC=1',
       # WTF_USE_DYNAMIC_ANNOTATIONS=1 may be defined in build/common.gypi
       # We can't define it here because it should be present only
       # in Debug or release_valgrind_build=1 builds.
-      'WTF_USE_WEBKIT_IMAGE_DECODERS=1',
     ],
     # We have to nest variables inside variables so that they can be overridden
     # through GYP_DEFINES.
diff --git a/Source/core/fileapi/Blob.cpp b/Source/core/fileapi/Blob.cpp
index e5e59a4..7ed2dfb 100644
--- a/Source/core/fileapi/Blob.cpp
+++ b/Source/core/fileapi/Blob.cpp
@@ -36,21 +36,9 @@
 #include "core/fileapi/File.h"
 #include "core/fileapi/ThreadableBlobRegistry.h"
 #include "core/inspector/ScriptCallStack.h"
-#include "core/platform/HistogramSupport.h"
 
 namespace WebCore {
 
-namespace {
-
-// Used in histograms to see when we can actually deprecate the prefixed slice.
-enum SliceHistogramEnum {
-    SliceWithoutPrefix,
-    SliceWithPrefix,
-    SliceHistogramEnumMax,
-};
-
-} // namespace
-
 Blob::Blob()
     : m_size(0)
 {
diff --git a/Source/core/fileapi/BlobURL.cpp b/Source/core/fileapi/BlobURL.cpp
index b105da4..653073a 100644
--- a/Source/core/fileapi/BlobURL.cpp
+++ b/Source/core/fileapi/BlobURL.cpp
@@ -35,7 +35,7 @@
 #include <wtf/text/WTFString.h>
 #include "core/platform/KURL.h"
 #include "core/platform/UUID.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/fileapi/FileReaderLoader.cpp b/Source/core/fileapi/FileReaderLoader.cpp
index 4ef3b93..f9d992e 100644
--- a/Source/core/fileapi/FileReaderLoader.cpp
+++ b/Source/core/fileapi/FileReaderLoader.cpp
@@ -98,6 +98,8 @@
     options.preflightPolicy = ConsiderPreflight;
     options.allowCredentials = AllowStoredCredentials;
     options.crossOriginRequestPolicy = DenyCrossOriginRequests;
+    // FIXME: Is there a directive to which this load should be subject?
+    options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy;
 
     if (m_client)
         m_loader = ThreadableLoader::create(scriptExecutionContext, this, request, options);
diff --git a/Source/core/fileapi/FileThread.cpp b/Source/core/fileapi/FileThread.cpp
deleted file mode 100644
index 991e335..0000000
--- a/Source/core/fileapi/FileThread.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "core/fileapi/FileThread.h"
-
-#include "core/platform/Logging.h"
-#include <wtf/AutodrainedPool.h>
-
-namespace WebCore {
-
-FileThread::FileThread()
-    : m_threadID(0)
-{
-    m_selfRef = this;
-}
-
-FileThread::~FileThread()
-{
-    ASSERT(m_queue.killed());
-}
-
-bool FileThread::start()
-{
-    MutexLocker lock(m_threadCreationMutex);
-    if (m_threadID)
-        return true;
-    m_threadID = createThread(FileThread::fileThreadStart, this, "WebCore: File");
-    return m_threadID;
-}
-
-void FileThread::stop()
-{
-    m_queue.kill();
-}
-
-void FileThread::postTask(PassOwnPtr<Task> task)
-{
-    m_queue.append(task);
-}
-
-class SameInstancePredicate {
-public:
-    SameInstancePredicate(const void* instance) : m_instance(instance) { }
-    bool operator()(FileThread::Task* task) const { return task->instance() == m_instance; }
-private:
-    const void* m_instance;
-};
-
-void FileThread::unscheduleTasks(const void* instance)
-{
-    SameInstancePredicate predicate(instance);
-    m_queue.removeIf(predicate);
-}
-
-void FileThread::fileThreadStart(void* arg)
-{
-    FileThread* fileThread = static_cast<FileThread*>(arg);
-    fileThread->runLoop();
-}
-
-void FileThread::runLoop()
-{
-    {
-        // Wait for FileThread::start() to complete to have m_threadID
-        // established before starting the main loop.
-        MutexLocker lock(m_threadCreationMutex);
-        LOG(FileAPI, "Started FileThread %p", this);
-    }
-
-    AutodrainedPool pool;
-    while (OwnPtr<Task> task = m_queue.waitForMessage()) {
-        task->performTask();
-        pool.cycle();
-    }
-
-    LOG(FileAPI, "About to detach thread %i and clear the ref to FileThread %p, which currently has %i ref(s)", m_threadID, this, refCount());
-
-    detachThread(m_threadID);
-
-    // Clear the self refptr, possibly resulting in deletion
-    m_selfRef = 0;
-}
-
-} // namespace WebCore
diff --git a/Source/core/fileapi/FileThread.h b/Source/core/fileapi/FileThread.h
deleted file mode 100644
index 0cc1640..0000000
--- a/Source/core/fileapi/FileThread.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef FileThread_h
-#define FileThread_h
-
-#include <wtf/MessageQueue.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
-
-namespace WebCore {
-
-class FileStream;
-
-class FileThread : public ThreadSafeRefCounted<FileThread> {
-public:
-    static PassRefPtr<FileThread> create()
-    {
-        return adoptRef(new FileThread());
-    }
-
-    ~FileThread();
-
-    bool start();
-    void stop();
-
-    class Task {
-        WTF_MAKE_NONCOPYABLE(Task);
-    public:
-        virtual ~Task() { }
-        virtual void performTask() = 0;
-        void* instance() const { return m_instance; }
-    protected:
-        Task(void* instance) : m_instance(instance) { }
-        void* m_instance;
-    };
-
-    void postTask(PassOwnPtr<Task> task);
-
-    void unscheduleTasks(const void* instance);
-
-private:
-    FileThread();
-
-    static void fileThreadStart(void*);
-    void runLoop();
-
-    ThreadIdentifier m_threadID;
-    RefPtr<FileThread> m_selfRef;
-    MessageQueue<Task> m_queue;
-
-    Mutex m_threadCreationMutex;
-};
-
-} // namespace WebCore
-
-#endif // FileThread_h
diff --git a/Source/core/fileapi/FileThreadTask.h b/Source/core/fileapi/FileThreadTask.h
deleted file mode 100644
index da9e4bc..0000000
--- a/Source/core/fileapi/FileThreadTask.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef FileThreadTask_h
-#define FileThreadTask_h
-
-#include "core/dom/CrossThreadTask.h"
-#include "core/fileapi/FileThread.h"
-#include "core/platform/CrossThreadCopier.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
-template<typename T>
-class FileThreadTask0 : public FileThread::Task {
-public:
-    typedef void (T::*Method)();
-    typedef FileThreadTask0<T> FileThreadTaskImpl;
-
-    static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method)
-    {
-        return adoptPtr(new FileThreadTaskImpl(instance, method));
-    }
-
-private:
-    FileThreadTask0(T* instance, Method method)
-        : FileThread::Task(instance)
-        , m_method(method)
-    {
-    }
-
-    virtual void performTask()
-    {
-        (*static_cast<T*>(instance()).*m_method)();
-    }
-
-private:
-    Method m_method;
-};
-
-template<typename T, typename P1, typename MP1>
-class FileThreadTask1 : public FileThread::Task {
-public:
-    typedef void (T::*Method)(MP1);
-    typedef FileThreadTask1<T, P1, MP1> FileThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
-
-    static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1)
-    {
-        return adoptPtr(new FileThreadTaskImpl(instance, method, parameter1));
-    }
-
-private:
-    FileThreadTask1(T* instance, Method method, Param1 parameter1)
-        : FileThread::Task(instance)
-        , m_method(method)
-        , m_parameter1(parameter1)
-    {
-    }
-
-    virtual void performTask()
-    {
-        (*static_cast<T*>(instance()).*m_method)(m_parameter1);
-    }
-
-private:
-    Method m_method;
-    P1 m_parameter1;
-};
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2>
-class FileThreadTask2 : public FileThread::Task {
-public:
-    typedef void (T::*Method)(MP1, MP2);
-    typedef FileThreadTask2<T, P1, MP1, P2, MP2> FileThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
-    typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
-
-    static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2)
-    {
-        return adoptPtr(new FileThreadTaskImpl(instance, method, parameter1, parameter2));
-    }
-
-private:
-    FileThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2)
-        : FileThread::Task(instance)
-        , m_method(method)
-        , m_parameter1(parameter1)
-        , m_parameter2(parameter2)
-    {
-    }
-
-    virtual void performTask()
-    {
-        (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2);
-    }
-
-private:
-    Method m_method;
-    P1 m_parameter1;
-    P2 m_parameter2;
-};
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
-class FileThreadTask3 : public FileThread::Task {
-public:
-    typedef void (T::*Method)(MP1, MP2, MP3);
-    typedef FileThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> FileThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
-    typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
-    typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
-
-    static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
-    {
-        return adoptPtr(new FileThreadTaskImpl(instance, method, parameter1, parameter2, parameter3));
-    }
-
-private:
-    FileThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
-        : FileThread::Task(instance)
-        , m_method(method)
-        , m_parameter1(parameter1)
-        , m_parameter2(parameter2)
-        , m_parameter3(parameter3)
-    {
-    }
-
-    virtual void performTask()
-    {
-        (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3);
-    }
-
-private:
-    Method m_method;
-    P1 m_parameter1;
-    P2 m_parameter2;
-    P3 m_parameter3;
-};
-
-template<typename T>
-PassOwnPtr<FileThread::Task> createFileThreadTask(
-    T* const callee,
-    void (T::*method)());
-
-template<typename T>
-PassOwnPtr<FileThread::Task> createFileThreadTask(
-    T* const callee,
-    void (T::*method)())
-{
-    return FileThreadTask0<T>::create(
-        callee,
-        method);
-}
-
-template<typename T, typename P1, typename MP1>
-PassOwnPtr<FileThread::Task> createFileThreadTask(
-    T* const callee,
-    void (T::*method)(MP1),
-    const P1& parameter1)
-{
-    return FileThreadTask1<T, typename CrossThreadCopier<P1>::Type, MP1>::create(
-        callee,
-        method,
-        CrossThreadCopier<P1>::copy(parameter1));
-}
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2>
-PassOwnPtr<FileThread::Task> createFileThreadTask(
-    T* const callee,
-    void (T::*method)(MP1, MP2),
-    const P1& parameter1,
-    const P2& parameter2)
-{
-    return FileThreadTask2<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create(
-        callee,
-        method,
-        CrossThreadCopier<P1>::copy(parameter1),
-        CrossThreadCopier<P2>::copy(parameter2));
-}
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
-PassOwnPtr<FileThread::Task> createFileThreadTask(
-    T* const callee,
-    void (T::*method)(MP1, MP2, MP3),
-    const P1& parameter1,
-    const P2& parameter2,
-    const P3& parameter3)
-{
-    return FileThreadTask3<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create(
-        callee,
-        method,
-        CrossThreadCopier<P1>::copy(parameter1),
-        CrossThreadCopier<P2>::copy(parameter2),
-        CrossThreadCopier<P3>::copy(parameter3));
-}
-
-} // namespace WebCore
-
-#endif // FileThreadTask_h
diff --git a/Source/core/fileapi/ThreadableBlobRegistry.cpp b/Source/core/fileapi/ThreadableBlobRegistry.cpp
index 6a0e2d0..bfb32cd 100644
--- a/Source/core/fileapi/ThreadableBlobRegistry.cpp
+++ b/Source/core/fileapi/ThreadableBlobRegistry.cpp
@@ -34,8 +34,8 @@
 #include "core/fileapi/BlobURL.h"
 #include "core/platform/network/BlobData.h"
 #include "core/platform/network/BlobRegistry.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityOriginCache.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityOriginCache.h"
 #include "wtf/HashMap.h"
 #include "wtf/MainThread.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/html/BaseChooserOnlyDateAndTimeInputType.cpp b/Source/core/html/BaseChooserOnlyDateAndTimeInputType.cpp
index e164ef1..174bf3c 100644
--- a/Source/core/html/BaseChooserOnlyDateAndTimeInputType.cpp
+++ b/Source/core/html/BaseChooserOnlyDateAndTimeInputType.cpp
@@ -28,7 +28,7 @@
 #include "core/html/BaseChooserOnlyDateAndTimeInputType.h"
 
 #include "bindings/v8/ScriptController.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/page/Chrome.h"
diff --git a/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp b/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp
index 701fddf..8df8139 100644
--- a/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp
+++ b/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp
@@ -33,10 +33,10 @@
 #include "core/html/BaseMultipleFieldsDateAndTimeInputType.h"
 
 #include "CSSValueKeywords.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/DateTimeFieldsState.h"
 #include "core/html/FormController.h"
 #include "core/html/HTMLDataListElement.h"
diff --git a/Source/core/html/CollectionType.h b/Source/core/html/CollectionType.h
index c576c11..9db25d4 100644
--- a/Source/core/html/CollectionType.h
+++ b/Source/core/html/CollectionType.h
@@ -41,7 +41,7 @@
     DocumentNamedItems,
 
     // Unnamed HTMLCollection types cached in elements.
-    NodeChildren, // first-level children (IE)
+    NodeChildren, // first-level children (ParentNode DOM interface)
     TableTBodies, // all <tbody> elements in this table
     TSectionRows, // all row elements in this table section
     TableRows,
diff --git a/Source/core/html/ColorInputType.cpp b/Source/core/html/ColorInputType.cpp
index bffe778..7cb6070 100644
--- a/Source/core/html/ColorInputType.cpp
+++ b/Source/core/html/ColorInputType.cpp
@@ -34,9 +34,9 @@
 
 #include "CSSPropertyNames.h"
 #include "bindings/v8/ScriptController.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/MouseEvent.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDataListElement.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLInputElement.h"
diff --git a/Source/core/html/DOMFormData.cpp b/Source/core/html/DOMFormData.cpp
index dbecd8b..cf4cbc4 100644
--- a/Source/core/html/DOMFormData.cpp
+++ b/Source/core/html/DOMFormData.cpp
@@ -42,11 +42,13 @@
 DOMFormData::DOMFormData(const WTF::TextEncoding& encoding)
     : FormDataList(encoding)
 {
+    ScriptWrappable::init(this);
 }
 
 DOMFormData::DOMFormData(HTMLFormElement* form)
     : FormDataList(UTF8Encoding())
 {
+    ScriptWrappable::init(this);
     if (!form)
         return;
 
diff --git a/Source/core/html/DOMFormData.h b/Source/core/html/DOMFormData.h
index fbf91e9..dfb2783 100644
--- a/Source/core/html/DOMFormData.h
+++ b/Source/core/html/DOMFormData.h
@@ -45,7 +45,7 @@
 class Blob;
 class HTMLFormElement;
 
-class DOMFormData : public FormDataList, public RefCounted<DOMFormData> {
+class DOMFormData : public FormDataList, public ScriptWrappable, public RefCounted<DOMFormData> {
 public:
     static PassRefPtr<DOMFormData> create(HTMLFormElement* form) { return adoptRef(new DOMFormData(form)); }
     static PassRefPtr<DOMFormData> create(const WTF::TextEncoding& encoding) { return adoptRef(new DOMFormData(encoding)); }
diff --git a/Source/core/html/DOMSettableTokenList.cpp b/Source/core/html/DOMSettableTokenList.cpp
index 4b34dba..a1dcafb 100644
--- a/Source/core/html/DOMSettableTokenList.cpp
+++ b/Source/core/html/DOMSettableTokenList.cpp
@@ -31,6 +31,7 @@
     : m_value()
     , m_tokens()
 {
+    ScriptWrappable::init(this);
 }
 
 DOMSettableTokenList::~DOMSettableTokenList()
diff --git a/Source/core/html/DOMTokenList.h b/Source/core/html/DOMTokenList.h
index 31fc342..400a830 100644
--- a/Source/core/html/DOMTokenList.h
+++ b/Source/core/html/DOMTokenList.h
@@ -25,8 +25,9 @@
 #ifndef DOMTokenList_h
 #define DOMTokenList_h
 
-#include <wtf/text/AtomicString.h>
-#include <wtf/Vector.h>
+#include "bindings/v8/ScriptWrappable.h"
+#include "wtf/Vector.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
@@ -34,10 +35,13 @@
 
 typedef int ExceptionCode;
 
-class DOMTokenList {
+class DOMTokenList : public ScriptWrappable {
     WTF_MAKE_NONCOPYABLE(DOMTokenList); WTF_MAKE_FAST_ALLOCATED;
 public:
-    DOMTokenList() { }
+    DOMTokenList()
+    {
+        ScriptWrappable::init(this);
+    }
     virtual ~DOMTokenList() {};
 
     virtual void ref() = 0;
diff --git a/Source/core/html/DOMURL.cpp b/Source/core/html/DOMURL.cpp
index 499baea..1087079 100644
--- a/Source/core/html/DOMURL.cpp
+++ b/Source/core/html/DOMURL.cpp
@@ -39,15 +39,15 @@
 #include "core/loader/cache/MemoryCache.h"
 #include "core/platform/KURL.h"
 #include "core/platform/network/ResourceRequest.h"
-#include "modules/mediasource/MediaSource.h"
 #include "modules/mediasource/MediaSourceRegistry.h"
+#include "modules/mediasource/WebKitMediaSource.h"
 #include "modules/mediastream/MediaStream.h"
 #include "modules/mediastream/MediaStreamRegistry.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
-String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaSource* source)
+String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, WebKitMediaSource* source)
 {
     // Since WebWorkers cannot obtain MediaSource objects, we should be on the main thread.
     ASSERT(isMainThread());
diff --git a/Source/core/html/DOMURL.h b/Source/core/html/DOMURL.h
index 8a59b24..d88bb07 100644
--- a/Source/core/html/DOMURL.h
+++ b/Source/core/html/DOMURL.h
@@ -36,7 +36,7 @@
 namespace WebCore {
 
 class Blob;
-class MediaSource;
+class WebKitMediaSource;
 class MediaStream;
 class ScriptExecutionContext;
 
@@ -49,7 +49,7 @@
 
     static String createObjectURL(ScriptExecutionContext*, Blob*);
     static void revokeObjectURL(ScriptExecutionContext*, const String&);
-    static String createObjectURL(ScriptExecutionContext*, MediaSource*);
+    static String createObjectURL(ScriptExecutionContext*, WebKitMediaSource*);
     static String createObjectURL(ScriptExecutionContext*, MediaStream*);
 };
 
diff --git a/Source/core/html/DateTimeInputType.cpp b/Source/core/html/DateTimeInputType.cpp
deleted file mode 100644
index 45e45b3..0000000
--- a/Source/core/html/DateTimeInputType.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#if ENABLE(INPUT_TYPE_DATETIME_INCOMPLETE)
-#include "core/html/DateTimeInputType.h"
-
-#include "HTMLNames.h"
-#include "core/html/HTMLInputElement.h"
-#include "core/html/InputTypeNames.h"
-#include "core/platform/DateComponents.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/PassOwnPtr.h>
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-#include "core/html/DateTimeFieldsState.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/PlatformLocale.h"
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
-#endif
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-static const int dateTimeDefaultStep = 60;
-static const int dateTimeDefaultStepBase = 0;
-static const int dateTimeStepScaleFactor = 1000;
-
-PassOwnPtr<InputType> DateTimeInputType::create(HTMLInputElement* element)
-{
-    return adoptPtr(new DateTimeInputType(element));
-}
-
-void DateTimeInputType::attach()
-{
-    observeFeatureIfVisible(UseCounter::InputTypeDateTime);
-}
-
-const AtomicString& DateTimeInputType::formControlType() const
-{
-    return InputTypeNames::datetime();
-}
-
-DateComponents::Type DateTimeInputType::dateType() const
-{
-    return DateComponents::DateTime;
-}
-
-Decimal DateTimeInputType::defaultValueForStepUp() const
-{
-    return Decimal::fromDouble(currentTimeMS());
-}
-
-StepRange DateTimeInputType::createStepRange(AnyStepHandling anyStepHandling) const
-{
-    DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (dateTimeDefaultStep, dateTimeDefaultStepBase, dateTimeStepScaleFactor, StepRange::ScaledStepValueShouldBeInteger));
-
-    const Decimal stepBase = parseToNumber(element()->fastGetAttribute(minAttr), 0);
-    const Decimal minimum = parseToNumber(element()->fastGetAttribute(minAttr), Decimal::fromDouble(DateComponents::minimumDateTime()));
-    const Decimal maximum = parseToNumber(element()->fastGetAttribute(maxAttr), Decimal::fromDouble(DateComponents::maximumDateTime()));
-    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->fastGetAttribute(stepAttr));
-    return StepRange(stepBase, minimum, maximum, step, stepDescription);
-}
-
-bool DateTimeInputType::parseToDateComponentsInternal(const UChar* characters, unsigned length, DateComponents* out) const
-{
-    ASSERT(out);
-    unsigned end;
-    return out->parseDateTime(characters, length, 0, end) && end == length;
-}
-
-bool DateTimeInputType::setMillisecondToDateComponents(double value, DateComponents* date) const
-{
-    ASSERT(date);
-    return date->setMillisecondsSinceEpochForDateTime(value);
-}
-
-bool DateTimeInputType::isDateTimeField() const
-{
-    return true;
-}
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-// FIXME: It is better to share code for DateTimeInputType::formatDateTimeFieldsState()
-// and DateTimeInputLocalType::formatDateTimeFieldsState().
-String DateTimeInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const
-{
-    if (!dateTimeFieldsState.hasDayOfMonth() || !dateTimeFieldsState.hasMonth() || !dateTimeFieldsState.hasYear()
-        || !dateTimeFieldsState.hasHour() || !dateTimeFieldsState.hasMinute() || !dateTimeFieldsState.hasAMPM())
-        return emptyString();
-
-    if (dateTimeFieldsState.hasMillisecond() && dateTimeFieldsState.millisecond()) {
-        return String::format("%04u-%02u-%02uT%02u:%02u:%02u.%03uZ",
-            dateTimeFieldsState.year(),
-            dateTimeFieldsState.month(),
-            dateTimeFieldsState.dayOfMonth(),
-            dateTimeFieldsState.hour23(),
-            dateTimeFieldsState.minute(),
-            dateTimeFieldsState.hasSecond() ? dateTimeFieldsState.second() : 0,
-            dateTimeFieldsState.millisecond());
-    }
-
-    if (dateTimeFieldsState.hasSecond() && dateTimeFieldsState.second()) {
-        return String::format("%04u-%02u-%02uT%02u:%02u:%02uZ",
-            dateTimeFieldsState.year(),
-            dateTimeFieldsState.month(),
-            dateTimeFieldsState.dayOfMonth(),
-            dateTimeFieldsState.hour23(),
-            dateTimeFieldsState.minute(),
-            dateTimeFieldsState.second());
-    }
-
-    return String::format("%04u-%02u-%02uT%02u:%02uZ",
-        dateTimeFieldsState.year(),
-        dateTimeFieldsState.month(),
-        dateTimeFieldsState.dayOfMonth(),
-        dateTimeFieldsState.hour23(),
-        dateTimeFieldsState.minute());
-}
-
-void DateTimeInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const
-{
-    if (shouldHaveSecondField(date)) {
-        layoutParameters.dateTimeFormat = layoutParameters.locale.dateTimeFormatWithSeconds();
-        layoutParameters.fallbackDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'";
-    } else {
-        layoutParameters.dateTimeFormat = layoutParameters.locale.dateTimeFormatWithoutSeconds();
-        layoutParameters.fallbackDateTimeFormat = "yyyy-MM-dd'T'HH:mm'Z'";
-    }
-    if (!parseToDateComponents(element()->fastGetAttribute(minAttr), &layoutParameters.minimum))
-        layoutParameters.minimum = DateComponents();
-    if (!parseToDateComponents(element()->fastGetAttribute(maxAttr), &layoutParameters.maximum))
-        layoutParameters.maximum = DateComponents();
-    layoutParameters.placeholderForDay = placeholderForDayOfMonthField();
-    layoutParameters.placeholderForMonth = placeholderForMonthField();
-    layoutParameters.placeholderForYear = placeholderForYearField();
-}
-
-bool DateTimeInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, bool hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const
-{
-    return hasYear && hasMonth && hasDay && hasAMPM && hasHour && hasMinute;
-}
-#endif
-
-String DateTimeInputType::sanitizeValue(const String& proposedValue) const
-{
-    DateComponents date;
-    if (!parseToDateComponents(proposedValue, &date))
-        return String();
-    return date.toString();
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/html/DateTimeInputType.h b/Source/core/html/DateTimeInputType.h
deleted file mode 100644
index 78c15d5..0000000
--- a/Source/core/html/DateTimeInputType.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DateTimeInputType_h
-#define DateTimeInputType_h
-
-#if ENABLE(INPUT_TYPE_DATETIME_INCOMPLETE)
-#include "core/html/BaseChooserOnlyDateAndTimeInputType.h"
-#include "core/html/BaseDateAndTimeInputType.h"
-#include "core/html/BaseMultipleFieldsDateAndTimeInputType.h"
-
-namespace WebCore {
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-typedef BaseMultipleFieldsDateAndTimeInputType BaseDateTimeInputType;
-#else
-typedef BaseChooserOnlyDateAndTimeInputType BaseDateTimeInputType;
-#endif
-
-class DateTimeInputType : public BaseDateTimeInputType {
-public:
-    static PassOwnPtr<InputType> create(HTMLInputElement*);
-
-private:
-    DateTimeInputType(HTMLInputElement* element) : BaseDateTimeInputType(element) { }
-    virtual void attach() OVERRIDE;
-    virtual const AtomicString& formControlType() const OVERRIDE;
-    virtual DateComponents::Type dateType() const OVERRIDE;
-    virtual StepRange createStepRange(AnyStepHandling) const OVERRIDE;
-    virtual Decimal defaultValueForStepUp() const OVERRIDE;
-    virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE;
-    virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE;
-    virtual bool isDateTimeField() const OVERRIDE;
-    virtual String sanitizeValue(const String&) const OVERRIDE;
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-    // BaseMultipleFieldsDateAndTimeInputType functions
-    virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL;
-    virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL;
-    virtual bool isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, bool hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const;
-#endif
-};
-
-} // namespace WebCore
-
-#endif
-#endif // DateTimeInputType_h
diff --git a/Source/core/html/FileInputType.cpp b/Source/core/html/FileInputType.cpp
index b61e2cb..0fbc3f9 100644
--- a/Source/core/html/FileInputType.cpp
+++ b/Source/core/html/FileInputType.cpp
@@ -24,9 +24,9 @@
 
 #include "HTMLNames.h"
 #include "bindings/v8/ScriptController.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/fileapi/File.h"
 #include "core/fileapi/FileList.h"
 #include "core/html/FormController.h"
diff --git a/Source/core/html/DOMFormData.idl b/Source/core/html/FormData.idl
similarity index 97%
rename from Source/core/html/DOMFormData.idl
rename to Source/core/html/FormData.idl
index 25d9ed1..1c03b25 100644
--- a/Source/core/html/DOMFormData.idl
+++ b/Source/core/html/FormData.idl
@@ -30,9 +30,9 @@
 
 [
     CustomConstructor(optional HTMLFormElement form),
-    InterfaceName=FormData,
+    ImplementedAs=DOMFormData,
     ImplementationLacksVTable
-] interface DOMFormData {
+] interface FormData {
     // void append(DOMString name, DOMString value);
     // void append(DOMString name, Blob value, optional DOMString filename);
     [Custom] void append([Default=Undefined] optional DOMString name, 
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
index 43abdc5..ad25243 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -47,8 +47,9 @@
 #include "core/platform/network/DNS.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/rendering/RenderImage.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/KnownPorts.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
 
 namespace WebCore {
 
@@ -64,13 +65,19 @@
 private:
     PrefetchEventHandler();
 
+    void reset();
+
     void handleMouseOver(Event* event);
     void handleMouseOut(Event* event);
     void handleLeftMouseDown(Event* event);
+    void handleGestureTapUnconfirmed(Event*);
+    void handleGestureTapDown(Event*);
     void handleClick(Event* event);
 
     double m_mouseOverTimestamp;
     double m_mouseDownTimestamp;
+    double m_tapDownTimestamp;
+    bool m_hadTapUnconfirmed;
 };
 
 using namespace HTMLNames;
@@ -647,9 +654,16 @@
 }
 
 HTMLAnchorElement::PrefetchEventHandler::PrefetchEventHandler()
-    : m_mouseOverTimestamp(0.0)
-    , m_mouseDownTimestamp(0.0)
 {
+    reset();
+}
+
+void HTMLAnchorElement::PrefetchEventHandler::reset()
+{
+    m_mouseOverTimestamp = 0;
+    m_mouseDownTimestamp = 0;
+    m_hadTapUnconfirmed = false;
+    m_tapDownTimestamp = 0;
 }
 
 void HTMLAnchorElement::PrefetchEventHandler::handleEvent(Event* event)
@@ -660,6 +674,10 @@
         handleMouseOut(event);
     else if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton)
         handleLeftMouseDown(event);
+    else if (event->type() == eventNames().gesturetapdownEvent)
+        handleGestureTapDown(event);
+    else if (event->type() == eventNames().gesturetapunconfirmedEvent)
+        handleGestureTapUnconfirmed(event);
     else if (isLinkClick(event))
         handleClick(event);
 }
@@ -690,6 +708,20 @@
     HistogramSupport::histogramEnumeration("MouseEventPrefetch.MouseDowns", 0, 2);
 }
 
+void HTMLAnchorElement::PrefetchEventHandler::handleGestureTapUnconfirmed(Event* event)
+{
+    m_hadTapUnconfirmed = true;
+
+    HistogramSupport::histogramEnumeration("MouseEventPrefetch.TapUnconfirmeds", 0, 2);
+}
+
+void HTMLAnchorElement::PrefetchEventHandler::handleGestureTapDown(Event* event)
+{
+    m_tapDownTimestamp = event->timeStamp();
+
+    HistogramSupport::histogramEnumeration("MouseEventPrefetch.TapDowns", 0, 2);
+}
+
 void HTMLAnchorElement::PrefetchEventHandler::handleClick(Event* event)
 {
     bool capturedMouseOver = (m_mouseOverTimestamp > 0.0);
@@ -708,8 +740,17 @@
         HistogramSupport::histogramCustomCounts("MouseEventPrefetch.MouseDownDuration_Click", mouseDownDuration * 1000, 0, 10000, 100);
     }
 
-    m_mouseOverTimestamp = 0;
-    m_mouseDownTimestamp = 0;
+    bool capturedTapDown = (m_tapDownTimestamp > 0.0);
+    if (capturedTapDown) {
+        double tapDownDuration = convertDOMTimeStampToSeconds(event->timeStamp() - m_tapDownTimestamp);
+
+        HistogramSupport::histogramCustomCounts("MouseEventPrefetch.TapDownDuration_Click", tapDownDuration * 1000, 0, 10000, 100);
+    }
+
+    int flags = (m_hadTapUnconfirmed ? 2 : 0) | (capturedTapDown ? 1 : 0);
+    HistogramSupport::histogramEnumeration("MouseEventPrefetch.PreTapEventsFollowedByClick", flags, 4);
+
+    reset();
 }
 
 }
diff --git a/Source/core/html/HTMLAppletElement.cpp b/Source/core/html/HTMLAppletElement.cpp
index 4367d19..ed9e85f 100644
--- a/Source/core/html/HTMLAppletElement.cpp
+++ b/Source/core/html/HTMLAppletElement.cpp
@@ -33,7 +33,7 @@
 #include "core/page/Settings.h"
 #include "core/platform/Widget.h"
 #include "core/rendering/RenderApplet.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLDetailsElement.cpp b/Source/core/html/HTMLDetailsElement.cpp
index 2118ef9..04af44e 100644
--- a/Source/core/html/HTMLDetailsElement.cpp
+++ b/Source/core/html/HTMLDetailsElement.cpp
@@ -24,8 +24,8 @@
 #include "HTMLNames.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLSummaryElement.h"
 #include "core/html/shadow/HTMLContentElement.h"
 #include "core/platform/LocalizedStrings.h"
diff --git a/Source/core/html/HTMLDialogElement.cpp b/Source/core/html/HTMLDialogElement.cpp
index 52718b3..6533aa2 100644
--- a/Source/core/html/HTMLDialogElement.cpp
+++ b/Source/core/html/HTMLDialogElement.cpp
@@ -92,13 +92,10 @@
     // FIXME: Figure out what to do in vertical writing mode.
     FrameView* frameView = document()->view();
     int scrollTop = frameView->scrollOffset().height();
-    FloatPoint absolutePoint(0, scrollTop);
     int visibleHeight = frameView->visibleContentRect(ScrollableArea::IncludeScrollbars).height();
+    m_top = scrollTop;
     if (box->height() < visibleHeight)
-        absolutePoint.move(0, (visibleHeight - box->height()) / 2);
-    FloatPoint localPoint = box->containingBlock()->absoluteToLocal(absolutePoint);
-
-    m_top = localPoint.y();
+        m_top += (visibleHeight - box->height()) / 2;
     m_topIsValid = true;
 
     // FIXME: It's inefficient to reattach here. We could do better by mutating style directly and forcing another layout.
@@ -134,4 +131,11 @@
     return HTMLElement::isPresentationAttribute(name);
 }
 
+bool HTMLDialogElement::shouldBeReparentedUnderRenderView(const RenderStyle* style) const
+{
+    if (style && style->position() == AbsolutePosition)
+        return true;
+    return Element::shouldBeReparentedUnderRenderView(style);
+}
+
 } // namespace WebCore
diff --git a/Source/core/html/HTMLDialogElement.h b/Source/core/html/HTMLDialogElement.h
index 7cdb739..7dcbed6 100644
--- a/Source/core/html/HTMLDialogElement.h
+++ b/Source/core/html/HTMLDialogElement.h
@@ -46,6 +46,7 @@
 
     virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
     virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
+    virtual bool shouldBeReparentedUnderRenderView(const RenderStyle*) const OVERRIDE;
     void positionAndReattach();
 
     bool m_topIsValid;
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index 67c66ba..080e4fd 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -726,12 +726,6 @@
     setAttribute(translateAttr, enable ? "yes" : "no");
 }
 
-
-PassRefPtr<HTMLCollection> HTMLElement::children()
-{
-    return ensureCachedHTMLCollection(NodeChildren);
-}
-
 bool HTMLElement::rendererIsNeeded(const NodeRenderingContext& context)
 {
     if (hasLocalName(noscriptTag)) {
diff --git a/Source/core/html/HTMLElement.h b/Source/core/html/HTMLElement.h
index 7a344d6..3f93fc2 100644
--- a/Source/core/html/HTMLElement.h
+++ b/Source/core/html/HTMLElement.h
@@ -41,8 +41,6 @@
 public:
     static PassRefPtr<HTMLElement> create(const QualifiedName& tagName, Document*);
 
-    PassRefPtr<HTMLCollection> children();
-
     virtual String title() const OVERRIDE FINAL;
 
     virtual short tabIndex() const;
diff --git a/Source/core/html/HTMLElement.idl b/Source/core/html/HTMLElement.idl
index a9de148..986942c 100644
--- a/Source/core/html/HTMLElement.idl
+++ b/Source/core/html/HTMLElement.idl
@@ -50,7 +50,6 @@
                             [Default=Undefined] optional DOMString text);
 
     [EnabledAtRuntime=imeAPI] InputMethodContext getInputContext();
-    readonly attribute HTMLCollection children;
 
              [TreatNullAs=NullString, SetterRaisesException] attribute DOMString contentEditable;
     readonly attribute boolean isContentEditable;
diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp
index b121575..0520578 100644
--- a/Source/core/html/HTMLFormControlElement.cpp
+++ b/Source/core/html/HTMLFormControlElement.cpp
@@ -27,9 +27,9 @@
 
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventNames.h"
+#include "core/dom/shadow/ElementShadow.h"
 #include "core/html/HTMLFieldSetElement.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
diff --git a/Source/core/html/HTMLFormElement.idl b/Source/core/html/HTMLFormElement.idl
index fdb1468..ba2674d 100644
--- a/Source/core/html/HTMLFormElement.idl
+++ b/Source/core/html/HTMLFormElement.idl
@@ -19,7 +19,6 @@
  */
 
 [
-    CustomIndexedGetter,
     CustomNamedGetter
 ] interface HTMLFormElement : HTMLElement {
     [Reflect=accept_charset] attribute DOMString acceptCharset;
@@ -34,6 +33,7 @@
 
     readonly attribute HTMLCollection elements;
     readonly attribute long length;
+    [ImplementedAs=item] getter Node(unsigned long index);
 
     [ImplementedAs=submitFromJavaScript] void submit();
     void reset();
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index 9188895..315c4b9 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -37,15 +37,16 @@
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
 #include "core/dom/Document.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/IdTargetObserver.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/ScopedEventQueue.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/TouchEvent.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/InsertionPoint.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/fileapi/FileList.h"
@@ -59,7 +60,6 @@
 #include "core/html/InputType.h"
 #include "core/html/SearchInputType.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/html/shadow/InsertionPoint.h"
 #include "core/page/Frame.h"
 #include "core/page/FrameView.h"
 #include "RuntimeEnabledFeatures.h"
@@ -1628,11 +1628,6 @@
     return m_inputType->isDateField();
 }
 
-bool HTMLInputElement::isDateTimeField() const
-{
-    return m_inputType->isDateTimeField();
-}
-
 bool HTMLInputElement::isDateTimeLocalField() const
 {
     return m_inputType->isDateTimeLocalField();
diff --git a/Source/core/html/HTMLInputElement.h b/Source/core/html/HTMLInputElement.h
index d98f710..ebc4e54 100644
--- a/Source/core/html/HTMLInputElement.h
+++ b/Source/core/html/HTMLInputElement.h
@@ -115,7 +115,6 @@
     bool isTelephoneField() const;
     bool isURLField() const;
     bool isDateField() const;
-    bool isDateTimeField() const;
     bool isDateTimeLocalField() const;
     bool isMonthField() const;
     bool isTimeField() const;
diff --git a/Source/core/html/HTMLKeygenElement.cpp b/Source/core/html/HTMLKeygenElement.cpp
index 8ffd99f..9ddd013 100644
--- a/Source/core/html/HTMLKeygenElement.cpp
+++ b/Source/core/html/HTMLKeygenElement.cpp
@@ -28,9 +28,9 @@
 #include "HTMLNames.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
-#include "core/dom/ElementShadow.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/FormDataList.h"
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLSelectElement.h"
diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp
index 0c5c868..c9844f2 100644
--- a/Source/core/html/HTMLLinkElement.cpp
+++ b/Source/core/html/HTMLLinkElement.cpp
@@ -49,7 +49,7 @@
 #include "core/page/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
@@ -193,7 +193,14 @@
     String type = m_type.lower();
     KURL url = getNonEmptyURLAttribute(hrefAttr);
 
-    if (!m_linkLoader.loadLink(m_relAttribute, type, m_sizes->toString(), url, document()))
+    if (m_relAttribute.iconType() != InvalidIcon && url.isValid() && !url.isEmpty()) {
+        if (!shouldLoadLink())
+            return;
+        if (document()->frame())
+            document()->frame()->loader()->didChangeIcons(m_relAttribute.iconType());
+    }
+
+    if (!m_linkLoader.loadLink(m_relAttribute, type, url, document()))
         return;
 
     if ((m_disabledState != Disabled) && m_relAttribute.isStyleSheet()
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index d927d74..69884e7 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -43,15 +43,15 @@
 #include "core/dom/Attribute.h"
 #include "core/dom/ClientRect.h"
 #include "core/dom/ClientRectList.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLSourceElement.h"
 #include "core/html/HTMLVideoElement.h"
@@ -85,11 +85,11 @@
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderVideo.h"
 #include "core/rendering/RenderView.h"
-#include "modules/mediasource/MediaSource.h"
 #include "modules/mediasource/MediaSourceRegistry.h"
+#include "modules/mediasource/WebKitMediaSource.h"
 #include "modules/mediastream/MediaStreamRegistry.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
 
 #include "RuntimeEnabledFeatures.h"
 #include "core/html/HTMLTrackElement.h"
@@ -109,10 +109,6 @@
 #include "MediaKeys.h"
 #endif
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-#include "core/platform/graphics/PlatformTextTrack.h"
-#endif
-
 using namespace std;
 
 namespace WebCore {
@@ -296,7 +292,7 @@
     if (m_mediaController)
         m_mediaController->removeMediaElement(this);
 
-    setSourceState(MediaSource::closedKeyword());
+    closeMediaSource();
 
 #if ENABLE(ENCRYPTED_MEDIA_V2)
     setMediaKeys(0);
@@ -642,7 +638,7 @@
     if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE)
         scheduleEvent(eventNames().abortEvent);
 
-    setSourceState(MediaSource::closedKeyword());
+    closeMediaSource();
 
     createMediaPlayer();
 
@@ -1353,7 +1349,7 @@
     // 7 - Queue a task to fire a simple event named error at the media element.
     scheduleEvent(eventNames().errorEvent);
 
-    setSourceState(MediaSource::closedKeyword());
+    closeMediaSource();
 
     // 8 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
     setShouldDelayLoadEvent(false);
@@ -1382,7 +1378,7 @@
     // 3 - Queue a task to fire a simple event named error at the media element.
     scheduleEvent(eventNames().errorEvent);
 
-    setSourceState(MediaSource::closedKeyword());
+    closeMediaSource();
 
     // 4 - Set the element's networkState attribute to the NETWORK_EMPTY value and queue a
     // task to fire a simple event called emptied at the element.
@@ -1882,7 +1878,7 @@
 
     // Always notify the media engine of a seek if the source is not closed. This ensures that the source is
     // always in a flushed state when the 'seeking' event fires.
-    if (m_mediaSource && m_mediaSource->readyState() != MediaSource::closedKeyword())
+    if (m_mediaSource && m_mediaSource->readyState() != WebKitMediaSource::closedKeyword())
         noSeekRequired = false;
 
     if (noSeekRequired) {
@@ -2245,14 +2241,13 @@
     updatePlayState();
 }
 
-void HTMLMediaElement::setSourceState(const String& state)
+void HTMLMediaElement::closeMediaSource()
 {
     if (!m_mediaSource)
-         return;
+        return;
 
-    m_mediaSource->setReadyState(state);
-    if (state == MediaSource::closedKeyword())
-        m_mediaSource = 0;
+    m_mediaSource->setReadyState(WebKitMediaSource::closedKeyword());
+    m_mediaSource = 0;
 }
 
 #if ENABLE(ENCRYPTED_MEDIA)
@@ -2588,80 +2583,10 @@
     removeTrack(textTrack.get());
 }
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-void HTMLMediaElement::setSelectedTextTrack(PassRefPtr<PlatformTextTrack> platformTrack)
-{
-    if (!m_textTracks)
-        return;
-
-    TrackDisplayUpdateScope scope(this);
-
-    if (!platformTrack) {
-        setSelectedTextTrack(0);
-        return;
-    }
-
-    TextTrack* textTrack;
-    size_t i;
-    for (i = 0; i < m_textTracks->length(); ++i) {
-        textTrack = m_textTracks->item(i);
-
-        if (textTrack->platformTextTrack() == platformTrack)
-            break;
-    }
-
-    if (i == m_textTracks->length())
-        return;
-    setSelectedTextTrack(textTrack);
-}
-
-Vector<RefPtr<PlatformTextTrack> > HTMLMediaElement::platformTextTracks()
-{
-    if (!m_textTracks || !m_textTracks->length())
-        return Vector<RefPtr<PlatformTextTrack> >();
-
-    Vector<RefPtr<PlatformTextTrack> > platformTracks;
-    for (size_t i = 0; i < m_textTracks->length(); ++i)
-        platformTracks.append(m_textTracks->item(i)->platformTextTrack());
-
-    return platformTracks;
-}
-
-void HTMLMediaElement::notifyMediaPlayerOfTextTrackChanges()
-{
-    if (!m_textTracks || !m_textTracks->length() || !platformTextTrackMenu())
-        return;
-
-    m_platformMenu->tracksDidChange();
-}
-
-PlatformTextTrackMenuInterface* HTMLMediaElement::platformTextTrackMenu()
-{
-    if (m_platformMenu)
-        return m_platformMenu.get();
-
-    if (!m_player->implementsTextTrackControls())
-        return 0;
-
-    m_platformMenu = m_player->textTrackMenu();
-    if (!m_platformMenu)
-        return 0;
-
-    m_platformMenu->setClient(this);
-
-    return m_platformMenu.get();
-}
-#endif // #if USE(PLATFORM_TEXT_TRACK_MENU)
-
 void HTMLMediaElement::closeCaptionTracksChanged()
 {
     if (hasMediaControls())
         mediaControls()->closedCaptionTracksChanged();
-
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    if (m_player->implementsTextTrackControls())
-        scheduleDelayedAction(TextTrackChangesNotification);
-#endif
 }
 
 void HTMLMediaElement::addTrack(TextTrack* track)
@@ -3609,7 +3534,7 @@
     // 3 - Queue a task to fire a simple event named error at the media element.
     scheduleEvent(eventNames().abortEvent);
 
-    setSourceState(MediaSource::closedKeyword());
+    closeMediaSource();
 
     // 4 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the
     // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a
@@ -3646,7 +3571,7 @@
 
     removeAllInbandTracks();
 
-    setSourceState(MediaSource::closedKeyword());
+    closeMediaSource();
 
     m_player.clear();
     stopPeriodicTimers();
@@ -3767,11 +3692,6 @@
         mediaControls()->exitedFullscreen();
 }
 
-PlatformMedia HTMLMediaElement::platformMedia() const
-{
-    return m_player ? m_player->platformMedia() : NoPlatformMedia;
-}
-
 PlatformLayer* HTMLMediaElement::platformLayer() const
 {
     return m_player ? m_player->platformLayer() : 0;
@@ -4010,7 +3930,7 @@
 #endif
 
     if (m_mediaSource)
-        m_mediaSource->setReadyState(MediaSource::closedKeyword());
+        closeMediaSource();
 
     m_player = MediaPlayer::create(this);
 
diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h
index eedbc78..63e122e 100644
--- a/Source/core/html/HTMLMediaElement.h
+++ b/Source/core/html/HTMLMediaElement.h
@@ -67,9 +67,6 @@
 
 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, public ActiveDOMObject, public MediaControllerInterface
     , private TextTrackClient
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    , public PlatformTextTrackMenuClient
-#endif
 {
 public:
     MediaPlayer* player() const { return m_player.get(); }
@@ -87,7 +84,6 @@
     virtual bool supportsSave() const;
     virtual bool supportsScanning() const;
     
-    PlatformMedia platformMedia() const;
     PlatformLayer* platformLayer() const;
 
     enum DelayedActionType {
@@ -157,7 +153,7 @@
     unsigned webkitVideoDecodedByteCount() const;
 
 //  Media Source.
-    void setSourceState(const String&);
+    void closeMediaSource();
 
 #if ENABLE(ENCRYPTED_MEDIA)
     void webkitGenerateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionCode&);
@@ -214,12 +210,6 @@
     virtual void mediaPlayerDidAddTrack(PassRefPtr<InbandTextTrackPrivate>) OVERRIDE;
     virtual void mediaPlayerDidRemoveTrack(PassRefPtr<InbandTextTrackPrivate>) OVERRIDE;
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    virtual void setSelectedTextTrack(PassRefPtr<PlatformTextTrack>) OVERRIDE;
-    virtual Vector<RefPtr<PlatformTextTrack> > platformTextTracks() OVERRIDE;
-    PlatformTextTrackMenuInterface* platformTextTrackMenu();
-#endif
-
     struct TrackGroup {
         enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, Other };
 
@@ -565,7 +555,7 @@
     // calling the media engine recursively.
     int m_processingMediaPlayerCallback;
 
-    RefPtr<MediaSource> m_mediaSource;
+    RefPtr<WebKitMediaSource> m_mediaSource;
 
     mutable double m_cachedTime;
     mutable double m_cachedTimeWallClockUpdateTime;
@@ -635,10 +625,6 @@
 #if ENABLE(ENCRYPTED_MEDIA_V2)
     RefPtr<MediaKeys> m_mediaKeys;
 #endif
-
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    RefPtr<PlatformTextTrackMenuInterface> m_platformMenu;
-#endif
 };
 
 #ifndef NDEBUG
diff --git a/Source/core/html/HTMLMeterElement.cpp b/Source/core/html/HTMLMeterElement.cpp
index f9e89c4..bbdb139 100644
--- a/Source/core/html/HTMLMeterElement.cpp
+++ b/Source/core/html/HTMLMeterElement.cpp
@@ -27,7 +27,7 @@
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/FormDataList.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
diff --git a/Source/core/html/HTMLOptionsCollection.idl b/Source/core/html/HTMLOptionsCollection.idl
index f5ee73d..5422e0a 100644
--- a/Source/core/html/HTMLOptionsCollection.idl
+++ b/Source/core/html/HTMLOptionsCollection.idl
@@ -22,11 +22,11 @@
     CustomIndexedSetter,
     CustomNamedGetter,
     GenerateIsReachable=ImplOwnerNodeRoot,
-    CustomIndexedGetter,
     DependentLifetime,
 ] interface HTMLOptionsCollection : HTMLCollection {
     attribute long selectedIndex;
     [CustomSetter, SetterRaisesException] attribute unsigned long length;
+    [ImplementedAs=item] getter Node(unsigned long index);
 
     [Custom] Node namedItem([Default=Undefined] optional DOMString name);
 
diff --git a/Source/core/html/HTMLPlugInImageElement.cpp b/Source/core/html/HTMLPlugInImageElement.cpp
index 7ac8711..c561283 100644
--- a/Source/core/html/HTMLPlugInImageElement.cpp
+++ b/Source/core/html/HTMLPlugInImageElement.cpp
@@ -28,8 +28,8 @@
 #include "core/dom/NodeList.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLImageLoader.h"
 #include "core/loader/FrameLoader.h"
@@ -39,7 +39,6 @@
 #include "core/page/Frame.h"
 #include "core/page/FrameView.h"
 #include "core/page/Page.h"
-#include "core/page/PlugInClient.h"
 #include "core/page/Settings.h"
 #include "core/platform/LocalizedStrings.h"
 #include "core/platform/Logging.h"
@@ -47,8 +46,8 @@
 #include "core/platform/graphics/Image.h"
 #include "core/rendering/RenderEmbeddedObject.h"
 #include "core/rendering/RenderImage.h"
-#include "origin/SchemeRegistry.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SchemeRegistry.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLProgressElement.cpp b/Source/core/html/HTMLProgressElement.cpp
index 5f7cef6..f3325b7 100644
--- a/Source/core/html/HTMLProgressElement.cpp
+++ b/Source/core/html/HTMLProgressElement.cpp
@@ -27,7 +27,7 @@
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/html/shadow/ProgressShadowElement.h"
diff --git a/Source/core/html/HTMLStyleElement.cpp b/Source/core/html/HTMLStyleElement.cpp
index 0d9a635..ab44bd8 100644
--- a/Source/core/html/HTMLStyleElement.cpp
+++ b/Source/core/html/HTMLStyleElement.cpp
@@ -34,7 +34,7 @@
 #include "core/dom/Event.h"
 #include "core/dom/EventSender.h"
 #include "core/dom/ScriptableDocumentParser.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLSummaryElement.cpp b/Source/core/html/HTMLSummaryElement.cpp
index 5f396a4..8ba9862 100644
--- a/Source/core/html/HTMLSummaryElement.cpp
+++ b/Source/core/html/HTMLSummaryElement.cpp
@@ -25,7 +25,7 @@
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDetailsElement.h"
 #include "core/html/shadow/DetailsMarkerControl.h"
 #include "core/html/shadow/HTMLContentElement.h"
diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp
index 6b5b5f1..21ebe40 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -31,13 +31,13 @@
 #include "core/dom/Attribute.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
 #include "core/dom/Document.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
diff --git a/Source/core/html/InputType.cpp b/Source/core/html/InputType.cpp
index bc82ef2..95cbd12 100644
--- a/Source/core/html/InputType.cpp
+++ b/Source/core/html/InputType.cpp
@@ -32,18 +32,17 @@
 #include "HTMLNames.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/fileapi/FileList.h"
 #include "core/html/ButtonInputType.h"
 #include "core/html/CheckboxInputType.h"
 #include "core/html/ColorInputType.h"
 #include "core/html/DateInputType.h"
-#include "core/html/DateTimeInputType.h"
 #include "core/html/DateTimeLocalInputType.h"
 #include "core/html/EmailInputType.h"
 #include "core/html/FileInputType.h"
@@ -97,10 +96,6 @@
     map->add(InputTypeNames::color(), ColorInputType::create);
 #endif
     map->add(InputTypeNames::date(), DateInputType::create);
-#if ENABLE(INPUT_TYPE_DATETIME_INCOMPLETE)
-    if (RuntimeEnabledFeatures::inputTypeDateTimeEnabled())
-        map->add(InputTypeNames::datetime(), DateTimeInputType::create);
-#endif
     map->add(InputTypeNames::datetimelocal(), DateTimeLocalInputType::create);
     map->add(InputTypeNames::email(), EmailInputType::create);
     map->add(InputTypeNames::file(), FileInputType::create);
@@ -799,11 +794,6 @@
     return false;
 }
 
-bool InputType::isDateTimeField() const
-{
-    return false;
-}
-
 bool InputType::isDateTimeLocalField() const
 {
     return false;
diff --git a/Source/core/html/InputType.h b/Source/core/html/InputType.h
index 7179120..0e0347b 100644
--- a/Source/core/html/InputType.h
+++ b/Source/core/html/InputType.h
@@ -106,7 +106,6 @@
 #endif
     virtual bool isCheckbox() const;
     virtual bool isDateField() const;
-    virtual bool isDateTimeField() const;
     virtual bool isDateTimeLocalField() const;
     virtual bool isEmailField() const;
     virtual bool isFileUpload() const;
diff --git a/Source/core/html/PublicURLManager.h b/Source/core/html/PublicURLManager.h
index dfdf533..63349ab 100644
--- a/Source/core/html/PublicURLManager.h
+++ b/Source/core/html/PublicURLManager.h
@@ -33,7 +33,6 @@
 
 #include "modules/mediastream/MediaStream.h"
 #include "modules/mediastream/MediaStreamRegistry.h"
-#include "modules/mediasource/MediaSource.h"
 #include "modules/mediasource/MediaSourceRegistry.h"
 
 namespace WebCore {
diff --git a/Source/core/html/RangeInputType.cpp b/Source/core/html/RangeInputType.cpp
index 75ebd80..14032a9 100644
--- a/Source/core/html/RangeInputType.cpp
+++ b/Source/core/html/RangeInputType.cpp
@@ -35,15 +35,15 @@
 #include <limits>
 #include "HTMLNames.h"
 #include "core/accessibility/AXObjectCache.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/ScopedEventQueue.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Touch.h"
 #include "core/dom/TouchEvent.h"
 #include "core/dom/TouchList.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
diff --git a/Source/core/html/SearchInputType.cpp b/Source/core/html/SearchInputType.cpp
index 87be461..08ad365 100644
--- a/Source/core/html/SearchInputType.cpp
+++ b/Source/core/html/SearchInputType.cpp
@@ -33,7 +33,7 @@
 
 #include "HTMLNames.h"
 #include "core/dom/KeyboardEvent.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/html/shadow/TextControlInnerElements.h"
diff --git a/Source/core/html/TextFieldInputType.cpp b/Source/core/html/TextFieldInputType.cpp
index 60e1ec6..4bb5857 100644
--- a/Source/core/html/TextFieldInputType.cpp
+++ b/Source/core/html/TextFieldInputType.cpp
@@ -34,12 +34,12 @@
 
 #include "HTMLNames.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/TextEvent.h"
 #include "core/dom/WheelEvent.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
diff --git a/Source/core/html/DOMURL.idl b/Source/core/html/URL.idl
similarity index 89%
rename from Source/core/html/DOMURL.idl
rename to Source/core/html/URL.idl
index c9fdd0a..399e664 100644
--- a/Source/core/html/DOMURL.idl
+++ b/Source/core/html/URL.idl
@@ -26,10 +26,10 @@
 
 [
     Constructor,
-    InterfaceName=URL,
+    ImplementedAs=DOMURL,
     ImplementationLacksVTable
-] interface DOMURL {
-    [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaSource? source);
+] interface URL {
+    [EnabledAtRuntime=webKitMediaSource,CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(WebKitMediaSource? source);
     [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaStream? stream);
     [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(Blob? blob);
     [CallWith=ScriptExecutionContext] static void revokeObjectURL(DOMString url);
diff --git a/Source/core/html/ValidationMessage.cpp b/Source/core/html/ValidationMessage.cpp
index 5149203..22ca12d 100644
--- a/Source/core/html/ValidationMessage.cpp
+++ b/Source/core/html/ValidationMessage.cpp
@@ -35,10 +35,10 @@
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
 #include "core/css/resolver/StyleResolver.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLBRElement.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLFormControlElement.h"
diff --git a/Source/core/html/ValidityState.idl b/Source/core/html/ValidityState.idl
index 3e45c2c..963c830 100644
--- a/Source/core/html/ValidityState.idl
+++ b/Source/core/html/ValidityState.idl
@@ -21,7 +21,6 @@
  */
 
 [
-    NoInterfaceObject,
     ImplementationLacksVTable
 ] interface ValidityState {
     readonly attribute boolean         valueMissing;
diff --git a/Source/core/html/canvas/CanvasRenderingContext.cpp b/Source/core/html/canvas/CanvasRenderingContext.cpp
index b637639..8aac89a 100644
--- a/Source/core/html/canvas/CanvasRenderingContext.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext.cpp
@@ -32,7 +32,7 @@
 #include "core/html/canvas/CanvasPattern.h"
 #include "core/loader/cache/CachedImage.h"
 #include "core/platform/KURL.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index a986d81..3dd9e56 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -67,7 +67,7 @@
 #include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/RenderHTMLCanvas.h"
 #include "core/rendering/RenderLayer.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #include <wtf/CheckedArithmetic.h>
 #include <wtf/MathExtras.h>
@@ -1031,7 +1031,7 @@
     if (shouldDrawShadows()) {
         context->save();
         saved = true;
-        context->setLegacyShadow(FloatSize(), 0, Color::transparent, ColorSpaceDeviceRGB);
+        context->clearShadow();
     }
     if (state().m_globalAlpha != 1) {
         if (!saved) {
@@ -1093,15 +1093,8 @@
 {
     if (!validateRectForCanvas(x, y, width, height))
         return;
-    strokeRect(x, y, width, height, state().m_lineWidth);
-}
 
-void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float height, float lineWidth)
-{
-    if (!validateRectForCanvas(x, y, width, height))
-        return;
-
-    if (!(lineWidth >= 0))
+    if (!(state().m_lineWidth >= 0))
         return;
 
     GraphicsContext* c = drawingContext();
@@ -1118,9 +1111,9 @@
     FloatRect rect(x, y, width, height);
 
     FloatRect boundingRect = rect;
-    boundingRect.inflate(lineWidth / 2);
+    boundingRect.inflate(state().m_lineWidth / 2);
 
-    c->strokeRect(rect, lineWidth);
+    c->strokeRect(rect, state().m_lineWidth);
     didDraw(boundingRect);
 }
 
@@ -1190,12 +1183,10 @@
     if (!c)
         return;
 
-    if (shouldDrawShadows()) {
-        float width = state().m_shadowOffset.width();
-        float height = state().m_shadowOffset.height();
-        c->setLegacyShadow(FloatSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
-    } else
-        c->setLegacyShadow(FloatSize(), 0, Color::transparent, ColorSpaceDeviceRGB);
+    if (shouldDrawShadows())
+        c->setShadow(state().m_shadowOffset, state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
+    else
+        c->clearShadow();
 }
 
 bool CanvasRenderingContext2D::shouldDrawShadows() const
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.h b/Source/core/html/canvas/CanvasRenderingContext2D.h
index cafba65..5873205 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.h
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
@@ -149,7 +149,6 @@
     void clearRect(float x, float y, float width, float height);
     void fillRect(float x, float y, float width, float height);
     void strokeRect(float x, float y, float width, float height);
-    void strokeRect(float x, float y, float width, float height, float lineWidth);
 
     void setShadow(float width, float height, float blur);
     void setShadow(float width, float height, float blur, const String& color);
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.idl b/Source/core/html/canvas/CanvasRenderingContext2D.idl
index 4d9e147..7e3d07f 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.idl
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.idl
@@ -65,7 +65,7 @@
 
     void beginPath();
 
-    attribute DOMPath currentPath;
+    attribute Path currentPath;
 
     // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface.
     void closePath();
@@ -115,7 +115,7 @@
     void setFillColor(float r, float g, float b, float a);
     void setFillColor(float c, float m, float y, float k, float a);
 
-    void strokeRect(float x, float y, float width, float height, optional float lineWidth);
+    void strokeRect(float x, float y, float width, float height);
 
     [RaisesException] void drawImage(HTMLImageElement? image, float x, float y);
     [RaisesException] void drawImage(HTMLImageElement? image, float x, float y, float width, float height);
diff --git a/Source/core/html/canvas/DOMPath.idl b/Source/core/html/canvas/Path.idl
similarity index 97%
rename from Source/core/html/canvas/DOMPath.idl
rename to Source/core/html/canvas/Path.idl
index 9a68c72..14ed146 100644
--- a/Source/core/html/canvas/DOMPath.idl
+++ b/Source/core/html/canvas/Path.idl
@@ -29,12 +29,12 @@
 [
     EnabledAtRuntime=canvasPath,
     Constructor,
-    Constructor(DOMPath path),
+    Constructor(Path path),
 #if defined(ENABLE_SVG) && ENABLE_SVG
     Constructor(DOMString text),
 #endif
-    InterfaceName=Path
-] interface DOMPath {
+    ImplementedAs=DOMPath
+] interface Path {
 
     // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface.
     void closePath();
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
index d29ad0b..37deadc 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
@@ -450,6 +450,17 @@
             break;
         }
     }
+
+    GraphicsContext3D::Attributes adjustAttributes(const GraphicsContext3D::Attributes& attributes, Settings* settings)
+    {
+        GraphicsContext3D::Attributes adjustedAttributes = attributes;
+        if (adjustedAttributes.antialias) {
+            if (settings && !settings->openGLMultisamplingEnabled())
+                adjustedAttributes.antialias = false;
+        }
+
+        return adjustedAttributes;
+    }
 } // namespace anonymous
 
 class WebGLRenderingContextLostCallback : public GraphicsContext3D::ContextLostCallback {
@@ -491,17 +502,13 @@
         return nullptr;
     }
 
-    GraphicsContext3D::Attributes attributes = attrs ? attrs->attributes() : GraphicsContext3D::Attributes();
+    GraphicsContext3D::Attributes requestedAttributes = attrs ? attrs->attributes() : GraphicsContext3D::Attributes();
+    requestedAttributes.noExtensions = true;
+    requestedAttributes.shareResources = true;
+    requestedAttributes.preferDiscreteGPU = true;
+    requestedAttributes.topDocumentURL = document->topDocument()->url();
 
-    if (attributes.antialias) {
-        if (settings && !settings->openGLMultisamplingEnabled())
-            attributes.antialias = false;
-    }
-
-    attributes.noExtensions = true;
-    attributes.shareResources = true;
-    attributes.preferDiscreteGPU = true;
-    attributes.topDocumentURL = document->topDocument()->url();
+    GraphicsContext3D::Attributes attributes = adjustAttributes(requestedAttributes, settings);
 
     RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes));
 
@@ -514,7 +521,7 @@
     if (extensions->supports("GL_EXT_debug_marker"))
         extensions->pushGroupMarkerEXT("WebGLRenderingContext");
 
-    OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRenderingContext(canvas, context, attributes));
+    OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRenderingContext(canvas, context, attributes, requestedAttributes));
     renderingContext->suspendIfNeeded();
 
     if (renderingContext->m_drawingBuffer->isZeroSized()) {
@@ -525,8 +532,7 @@
     return renderingContext.release();
 }
 
-WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context,
-                                             GraphicsContext3D::Attributes attributes)
+WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context, GraphicsContext3D::Attributes attributes, GraphicsContext3D::Attributes requestedAttributes)
     : CanvasRenderingContext(passedCanvas)
     , ActiveDOMObject(passedCanvas->document())
     , m_context(context)
@@ -538,8 +544,11 @@
     , m_contextLost(false)
     , m_contextLostMode(SyntheticLostContext)
     , m_attributes(attributes)
+    , m_requestedAttributes(requestedAttributes)
     , m_synthesizedErrorsToConsole(true)
     , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole)
+    , m_multisamplingAllowed(false)
+    , m_multisamplingObserverRegistered(false)
 {
     ASSERT(m_context);
     ScriptWrappable::init(this);
@@ -645,9 +654,16 @@
     ASSERT(m_context);
 
     Page* p = canvas()->document()->page();
-    if (p)
+    if (p) {
         m_synthesizedErrorsToConsole = p->settings()->webGLErrorsToConsoleEnabled();
 
+        if (!m_multisamplingObserverRegistered && m_requestedAttributes.antialias) {
+            m_multisamplingAllowed = m_drawingBuffer->multisample();
+            p->addMultisamplingChangedObserver(this);
+            m_multisamplingObserverRegistered = true;
+        }
+    }
+
     m_isGLES2NPOTStrict = !m_context->getExtensions()->isEnabled("GL_OES_texture_npot");
     m_isDepthStencilSupported = m_context->getExtensions()->isEnabled("GL_OES_packed_depth_stencil");
     m_isRobustnessEXTSupported = m_context->getExtensions()->isEnabled("GL_EXT_robustness");
@@ -691,6 +707,12 @@
     destroyGraphicsContext3D();
     m_contextGroup->removeContext(this);
 
+    if (m_multisamplingObserverRegistered) {
+        Page* page = canvas()->document()->page();
+        if (page)
+            page->removeMultisamplingChangedObserver(this);
+    }
+
     willDestroyContext(this);
 }
 
@@ -3463,6 +3485,12 @@
     // Otherwise, it will fall back to the normal SW path.
     WebGLTexture* texture = validateTextureBinding("texImage2D", target, true);
     if (GraphicsContext3D::TEXTURE_2D == target && texture) {
+        // FIXME: Currently we must make sure the target texture has the correct size before copying
+        // because of crbug.com/225781. Remove this once that bug is fixed.
+        if (texture->getWidth(target, level) != video->videoWidth() || texture->getHeight(target, level) != video->videoHeight()) {
+            m_context->texImage2D(target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, 0);
+            texture->setLevelInfo(target, level, internalformat, video->videoWidth(), video->videoHeight(), type);
+        }
         if (video->copyVideoTextureToPlatformTexture(m_context.get(), texture->object(), level, type, internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
             texture->setLevelInfo(target, level, internalformat, video->videoWidth(), video->videoHeight(), type);
             return;
@@ -5233,7 +5261,7 @@
     canvas()->dispatchEvent(event);
     m_restoreAllowed = event->defaultPrevented();
     deactivateContext(this, m_contextLostMode != RealLostContext && m_restoreAllowed);
-    if (m_contextLostMode == RealLostContext && m_restoreAllowed)
+    if ((m_contextLostMode == RealLostContext || m_contextLostMode == AutoRecoverSyntheticLostContext) && m_restoreAllowed)
         m_restoreTimer.startOneShot(0);
 }
 
@@ -5257,10 +5285,16 @@
     if (!frame)
         return;
 
-    if (!frame->loader()->client()->allowWebGL(frame->settings() && frame->settings()->webGLEnabled()))
+    Settings* settings = frame->settings();
+
+    if (!frame->loader()->client()->allowWebGL(settings && settings->webGLEnabled()))
         return;
 
+    // Reset the context attributes back to the requested attributes and re-apply restrictions
+    m_attributes = adjustAttributes(m_requestedAttributes, settings);
+
     RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(m_attributes));
+
     if (!context) {
         if (m_contextLostMode == RealLostContext)
             m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts);
@@ -5450,4 +5484,12 @@
     bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get(), ec);
 }
 
+void WebGLRenderingContext::multisamplingChanged(bool enabled)
+{
+    if (m_multisamplingAllowed != enabled) {
+        m_multisamplingAllowed = enabled;
+        forceLostContext(WebGLRenderingContext::AutoRecoverSyntheticLostContext);
+    }
+}
+
 } // namespace WebCore
diff --git a/Source/core/html/canvas/WebGLRenderingContext.h b/Source/core/html/canvas/WebGLRenderingContext.h
index 5314306..16c7fb7 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.h
+++ b/Source/core/html/canvas/WebGLRenderingContext.h
@@ -29,6 +29,7 @@
 #include "core/dom/ActiveDOMObject.h"
 #include "core/html/canvas/CanvasRenderingContext.h"
 #include "core/html/canvas/WebGLGetInfo.h"
+#include "core/page/Page.h"
 #include "core/platform/Timer.h"
 #include "core/platform/graphics/GraphicsContext3D.h"
 #include "core/platform/graphics/ImageBuffer.h"
@@ -80,7 +81,7 @@
 
 typedef int ExceptionCode;
 
-class WebGLRenderingContext : public CanvasRenderingContext, public ActiveDOMObject {
+class WebGLRenderingContext : public CanvasRenderingContext, public ActiveDOMObject, private Page::MultisamplingChangedObserver {
 public:
     static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLContextAttributes*);
     virtual ~WebGLRenderingContext();
@@ -294,7 +295,10 @@
         RealLostContext,
 
         // Lost context provoked by WEBKIT_lose_context.
-        SyntheticLostContext
+        SyntheticLostContext,
+
+        // A synthetic lost context that should attempt to recover automatically
+        AutoRecoverSyntheticLostContext
     };
     void forceLostContext(LostContextMode);
     void forceRestoreContext();
@@ -331,7 +335,7 @@
     friend class WebGLRenderingContextErrorMessageCallback;
     friend class WebGLVertexArrayObjectOES;
 
-    WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes);
+    WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes, GraphicsContext3D::Attributes);
     void initializeNewContext();
     void setupFlags();
 
@@ -493,6 +497,7 @@
     bool m_contextLost;
     LostContextMode m_contextLostMode;
     GraphicsContext3D::Attributes m_attributes;
+    GraphicsContext3D::Attributes m_requestedAttributes;
 
     bool m_layerCleared;
     GC3Dfloat m_clearColor[4];
@@ -769,6 +774,10 @@
     void restoreCurrentFramebuffer();
     void restoreCurrentTexture2D();
 
+    virtual void multisamplingChanged(bool);
+    bool m_multisamplingAllowed;
+    bool m_multisamplingObserverRegistered;
+
     friend class WebGLStateRestorer;
     friend class WebGLRenderingContextEvictionManager;
 
diff --git a/Source/core/html/parser/BackgroundHTMLParser.cpp b/Source/core/html/parser/BackgroundHTMLParser.cpp
index d14adf8..dfeea54 100644
--- a/Source/core/html/parser/BackgroundHTMLParser.cpp
+++ b/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -145,7 +145,7 @@
 
     while (true) {
         m_sourceTracker.start(m_input.current(), m_tokenizer.get(), *m_token);
-        if (!m_tokenizer->nextToken(m_input.current(), *m_token.get())) {
+        if (!m_tokenizer->nextToken(m_input.current(), *m_token)) {
             // We've reached the end of our current input.
             sendTokensToMainThread();
             break;
diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp
index 863f038..01b8b20 100644
--- a/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -404,13 +404,6 @@
     for (Vector<CompactHTMLToken>::const_iterator it = tokens->begin(); it != tokens->end(); ++it) {
         ASSERT(!isWaitingForScripts());
 
-        m_textPosition = it->textPosition();
-
-        constructTreeFromCompactHTMLToken(*it);
-
-        if (isStopped())
-            break;
-
         if (!isParsingFragment()
             && document()->frame() && document()->frame()->navigationScheduler()->locationChangePending()) {
 
@@ -423,6 +416,13 @@
             break;
         }
 
+        m_textPosition = it->textPosition();
+
+        constructTreeFromCompactHTMLToken(*it);
+
+        if (isStopped())
+            break;
+
         if (isWaitingForScripts()) {
             ASSERT(it + 1 == tokens->end()); // The </script> is assumed to be the last token of this bunch.
             runScriptsForPausedTreeBuilder();
diff --git a/Source/core/html/parser/HTMLDocumentParser.h b/Source/core/html/parser/HTMLDocumentParser.h
index 38aa2a9..69130d5 100644
--- a/Source/core/html/parser/HTMLDocumentParser.h
+++ b/Source/core/html/parser/HTMLDocumentParser.h
@@ -170,7 +170,7 @@
     bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; }
     bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts() || isScheduledForResume() || isExecutingScript(); }
 
-    HTMLToken& token() { return *m_token.get(); }
+    HTMLToken& token() { return *m_token; }
 
     HTMLParserOptions m_options;
     HTMLInputStream m_input;
diff --git a/Source/core/html/parser/HTMLTreeBuilder.h b/Source/core/html/parser/HTMLTreeBuilder.h
index 61138ac..bb98d37 100644
--- a/Source/core/html/parser/HTMLTreeBuilder.h
+++ b/Source/core/html/parser/HTMLTreeBuilder.h
@@ -27,14 +27,10 @@
 #ifndef HTMLTreeBuilder_h
 #define HTMLTreeBuilder_h
 
-#include "core/dom/FragmentScriptingPermission.h"
 #include "core/html/parser/HTMLConstructionSite.h"
 #include "core/html/parser/HTMLElementStack.h"
-#include "core/html/parser/HTMLFormattingElementList.h"
 #include "core/html/parser/HTMLParserOptions.h"
-#include "core/html/parser/HTMLTokenizer.h"
 #include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
diff --git a/Source/core/html/parser/InputStreamPreprocessor.h b/Source/core/html/parser/InputStreamPreprocessor.h
index 0d6ee30..a35711d 100644
--- a/Source/core/html/parser/InputStreamPreprocessor.h
+++ b/Source/core/html/parser/InputStreamPreprocessor.h
@@ -53,7 +53,6 @@
     // characters in |source| (after collapsing \r\n, etc).
     ALWAYS_INLINE bool peek(SegmentedString& source)
     {
-    PeekAgain:
         m_nextInputCharacter = source.currentChar();
 
         // Every branch in this function is expensive, so we have a
@@ -65,6 +64,31 @@
             m_skipNextNewLine = false;
             return true;
         }
+        return processNextInputCharacter(source);
+    }
+
+    // Returns whether there are more characters in |source| after advancing.
+    ALWAYS_INLINE bool advance(SegmentedString& source)
+    {
+        source.advanceAndUpdateLineNumber();
+        if (source.isEmpty())
+            return false;
+        return peek(source);
+    }
+
+    bool skipNextNewLine() const { return m_skipNextNewLine; }
+
+    void reset(bool skipNextNewLine = false)
+    {
+        m_nextInputCharacter = '\0';
+        m_skipNextNewLine = skipNextNewLine;
+    }
+
+private:
+    bool processNextInputCharacter(SegmentedString& source)
+    {
+    ProcessAgain:
+        ASSERT(m_nextInputCharacter == source.currentChar());
 
         if (m_nextInputCharacter == '\n' && m_skipNextNewLine) {
             m_skipNextNewLine = false;
@@ -87,7 +111,8 @@
                     source.advancePastNonNewline();
                     if (source.isEmpty())
                         return false;
-                    goto PeekAgain;
+                    m_nextInputCharacter = source.currentChar();
+                    goto ProcessAgain;
                 }
                 m_nextInputCharacter = 0xFFFD;
             }
@@ -95,24 +120,6 @@
         return true;
     }
 
-    // Returns whether there are more characters in |source| after advancing.
-    ALWAYS_INLINE bool advance(SegmentedString& source)
-    {
-        source.advanceAndUpdateLineNumber();
-        if (source.isEmpty())
-            return false;
-        return peek(source);
-    }
-
-    bool skipNextNewLine() const { return m_skipNextNewLine; }
-
-    void reset(bool skipNextNewLine = false)
-    {
-        m_nextInputCharacter = '\0';
-        m_skipNextNewLine = skipNextNewLine;
-    }
-
-private:
     bool shouldTreatNullAsEndOfFileMarker(SegmentedString& source) const
     {
         return source.isClosed() && source.length() == 1;
diff --git a/Source/core/html/parser/XSSAuditor.cpp b/Source/core/html/parser/XSSAuditor.cpp
index c879930..86fe66a 100644
--- a/Source/core/html/parser/XSSAuditor.cpp
+++ b/Source/core/html/parser/XSSAuditor.cpp
@@ -50,7 +50,7 @@
 #include "core/platform/KURL.h"
 #include "core/platform/network/FormData.h"
 #include "core/platform/text/DecodeEscapeSequences.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include "wtf/Functional.h"
 #include "wtf/MainThread.h"
 #include "wtf/text/CString.h"
diff --git a/Source/core/html/parser/XSSAuditorDelegate.cpp b/Source/core/html/parser/XSSAuditorDelegate.cpp
index 38ec60a..8e870a9 100644
--- a/Source/core/html/parser/XSSAuditorDelegate.cpp
+++ b/Source/core/html/parser/XSSAuditorDelegate.cpp
@@ -38,7 +38,7 @@
 #include "core/page/DOMWindow.h"
 #include "core/page/Frame.h"
 #include "core/platform/network/FormData.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/DateTimeEditElement.cpp b/Source/core/html/shadow/DateTimeEditElement.cpp
index 678f58e..f17244d 100644
--- a/Source/core/html/shadow/DateTimeEditElement.cpp
+++ b/Source/core/html/shadow/DateTimeEditElement.cpp
@@ -94,9 +94,7 @@
     , m_secondRange(0, 59)
     , m_millisecondRange(0, 999)
 {
-    if (m_dateValue.type() == DateComponents::Date
-        || m_dateValue.type() == DateComponents::DateTimeLocal
-        || m_dateValue.type() == DateComponents::DateTime) {
+    if (m_dateValue.type() == DateComponents::Date || m_dateValue.type() == DateComponents::DateTimeLocal) {
         if (m_parameters.minimum.type() != DateComponents::Invalid
             && m_parameters.maximum.type() != DateComponents::Invalid
             && m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear()
@@ -352,7 +350,7 @@
 
     if (m_dateValue.type() == DateComponents::Time)
         return false;
-    ASSERT(m_dateValue.type() == DateComponents::DateTimeLocal || m_dateValue.type() == DateComponents::DateTime);
+    ASSERT(m_dateValue.type() == DateComponents::DateTimeLocal);
 
     if (shouldDayOfMonthFieldDisabled()) {
         ASSERT(m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear());
diff --git a/Source/core/html/shadow/DateTimeFieldElement.cpp b/Source/core/html/shadow/DateTimeFieldElement.cpp
index 46e0868..16abc5e 100644
--- a/Source/core/html/shadow/DateTimeFieldElement.cpp
+++ b/Source/core/html/shadow/DateTimeFieldElement.cpp
@@ -224,7 +224,7 @@
     if (textNode->wholeText() == newVisibleValue)
         return;
 
-    textNode->replaceWholeText(newVisibleValue, ASSERT_NO_EXCEPTION);
+    textNode->replaceWholeText(newVisibleValue);
     if (hasValue()) {
         setAttribute(aria_valuetextAttr, newVisibleValue);
         setAttribute(aria_valuenowAttr, String::number(valueForARIAValueNow()));
diff --git a/Source/core/html/shadow/HTMLContentElement.cpp b/Source/core/html/shadow/HTMLContentElement.cpp
index 90c50eb..79cf9ef 100644
--- a/Source/core/html/shadow/HTMLContentElement.cpp
+++ b/Source/core/html/shadow/HTMLContentElement.cpp
@@ -28,12 +28,12 @@
 #include "core/html/shadow/HTMLContentElement.h"
 
 #include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
 #include "core/css/CSSParser.h"
 #include "core/dom/QualifiedName.h"
-#include "core/dom/ShadowRoot.h"
-#include "core/html/shadow/ContentDistributor.h"
-#include "core/html/shadow/ContentSelectorQuery.h"
-#include "RuntimeEnabledFeatures.h"
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ContentSelectorQuery.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include <wtf/StdLibExtras.h>
 
 namespace WebCore {
diff --git a/Source/core/html/shadow/HTMLContentElement.h b/Source/core/html/shadow/HTMLContentElement.h
index a03e00b..6f30076 100644
--- a/Source/core/html/shadow/HTMLContentElement.h
+++ b/Source/core/html/shadow/HTMLContentElement.h
@@ -32,7 +32,7 @@
 #define HTMLContentElement_h
 
 #include "core/css/CSSSelectorList.h"
-#include "core/html/shadow/InsertionPoint.h"
+#include "core/dom/shadow/InsertionPoint.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
diff --git a/Source/core/html/shadow/HTMLShadowElement.cpp b/Source/core/html/shadow/HTMLShadowElement.cpp
index ad304ea..7c1383f 100644
--- a/Source/core/html/shadow/HTMLShadowElement.cpp
+++ b/Source/core/html/shadow/HTMLShadowElement.cpp
@@ -32,7 +32,7 @@
 #include "core/html/shadow/HTMLShadowElement.h"
 
 #include "HTMLNames.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
diff --git a/Source/core/html/shadow/HTMLShadowElement.h b/Source/core/html/shadow/HTMLShadowElement.h
index 4ea0b66..20fd615 100644
--- a/Source/core/html/shadow/HTMLShadowElement.h
+++ b/Source/core/html/shadow/HTMLShadowElement.h
@@ -31,7 +31,7 @@
 #ifndef HTMLShadowElement_h
 #define HTMLShadowElement_h
 
-#include "core/html/shadow/InsertionPoint.h"
+#include "core/dom/shadow/InsertionPoint.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
diff --git a/Source/core/html/shadow/MeterShadowElement.cpp b/Source/core/html/shadow/MeterShadowElement.cpp
index 826bf93..2a3951d 100644
--- a/Source/core/html/shadow/MeterShadowElement.cpp
+++ b/Source/core/html/shadow/MeterShadowElement.cpp
@@ -35,7 +35,7 @@
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
 #include "core/css/StylePropertySet.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLMeterElement.h"
 #include "core/rendering/RenderMeter.h"
 #include "core/rendering/RenderTheme.h"
diff --git a/Source/core/html/shadow/SliderThumbElement.cpp b/Source/core/html/shadow/SliderThumbElement.cpp
index 775deb3..2b0cf5f 100644
--- a/Source/core/html/shadow/SliderThumbElement.cpp
+++ b/Source/core/html/shadow/SliderThumbElement.cpp
@@ -34,10 +34,10 @@
 #include "core/html/shadow/SliderThumbElement.h"
 
 #include "CSSValueKeywords.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/MouseEvent.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/StepRange.h"
 #include "core/html/parser/HTMLParserIdioms.h"
diff --git a/Source/core/html/shadow/TextFieldDecorationElement.cpp b/Source/core/html/shadow/TextFieldDecorationElement.cpp
index 86d709c..138142a 100644
--- a/Source/core/html/shadow/TextFieldDecorationElement.cpp
+++ b/Source/core/html/shadow/TextFieldDecorationElement.cpp
@@ -34,10 +34,10 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "core/css/resolver/StyleResolver.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/shadow/HTMLShadowElement.h"
 #include "core/rendering/RenderImage.h"
diff --git a/Source/core/html/track/InbandTextTrack.h b/Source/core/html/track/InbandTextTrack.h
index 01add05..db73064 100644
--- a/Source/core/html/track/InbandTextTrack.h
+++ b/Source/core/html/track/InbandTextTrack.h
@@ -56,10 +56,6 @@
     virtual void addGenericCue(InbandTextTrackPrivate*, GenericCueData*) OVERRIDE;
     virtual void addWebVTTCue(InbandTextTrackPrivate*, double, double, const String&, const String&, const String&) OVERRIDE;
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    virtual InbandTextTrackPrivate* privateTrack() OVERRIDE { return m_private.get(); }
-#endif
-
     RefPtr<InbandTextTrackPrivate> m_private;
 };
 
diff --git a/Source/core/html/track/TextTrack.cpp b/Source/core/html/track/TextTrack.cpp
index 0e86b91..7ff21ee 100644
--- a/Source/core/html/track/TextTrack.cpp
+++ b/Source/core/html/track/TextTrack.cpp
@@ -482,38 +482,6 @@
     return false;
 }
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-PassRefPtr<PlatformTextTrack> TextTrack::platformTextTrack()
-{
-    if (m_platformTextTrack)
-        return m_platformTextTrack;
-
-    PlatformTextTrack::TrackKind kind = PlatformTextTrack::Caption;
-    if (m_kind == subtitlesKeyword())
-        kind = PlatformTextTrack::Subtitle;
-    else if (m_kind == captionsKeyword())
-        kind = PlatformTextTrack::Caption;
-    else if (m_kind == descriptionsKeyword())
-        kind = PlatformTextTrack::Description;
-    else if (m_kind == chaptersKeyword())
-        kind = PlatformTextTrack::Chapter;
-    else if (m_kind == metadataKeyword())
-        kind = PlatformTextTrack::MetaData;
-
-    PlatformTextTrack::TrackType type = PlatformTextTrack::OutOfBand;
-    if (m_trackType == TrackElement)
-        type = PlatformTextTrack::OutOfBand;
-    else if (m_trackType == AddTrack)
-        type = PlatformTextTrack::Script;
-    else if (m_trackType == InBand)
-        type = PlatformTextTrack::InBand;
-
-    m_platformTextTrack = PlatformTextTrack::create(this, m_label, m_language, kind, type);
-
-    return m_platformTextTrack;
-}
-#endif
-
 bool TextTrack::isMainProgramContent() const
 {
     // "Main program" content is intrinsic to the presentation of the media file, regardless of locale. Content such as
diff --git a/Source/core/html/track/TextTrack.h b/Source/core/html/track/TextTrack.h
index ba8734f..767c2f9 100644
--- a/Source/core/html/track/TextTrack.h
+++ b/Source/core/html/track/TextTrack.h
@@ -33,10 +33,6 @@
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-#include "core/platform/graphics/PlatformTextTrack.h"
-#endif
-
 namespace WebCore {
 
 class HTMLMediaElement;
@@ -59,11 +55,7 @@
     virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0;
 };
 
-class TextTrack : public TrackBase
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    , public PlatformTextTrackClient
-#endif
-    {
+class TextTrack : public TrackBase {
 public:
     static PassRefPtr<TextTrack> create(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& label, const AtomicString& language)
     {
@@ -145,10 +137,6 @@
 
     void removeAllCues();
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    PassRefPtr<PlatformTextTrack> platformTextTrack();
-#endif
-
 protected:
     TextTrack(ScriptExecutionContext*, TextTrackClient*, const AtomicString& kind, const AtomicString& label, const AtomicString& language, TextTrackType);
 #if ENABLE(WEBVTT_REGIONS)
@@ -164,12 +152,6 @@
     RefPtr<TextTrackRegionList> m_regions;
 #endif
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    virtual TextTrack* publicTrack() OVERRIDE { return this; }
-
-    RefPtr<PlatformTextTrack> m_platformTextTrack;
-#endif
-
     TextTrackCueList* ensureTextTrackCueList();
 
     HTMLMediaElement* m_mediaElement;
diff --git a/Source/core/inspector/DOMEditor.cpp b/Source/core/inspector/DOMEditor.cpp
index 095e4b2..045a574 100644
--- a/Source/core/inspector/DOMEditor.cpp
+++ b/Source/core/inspector/DOMEditor.cpp
@@ -265,15 +265,15 @@
         return redo(ec);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionCode&)
     {
-        m_textNode->replaceWholeText(m_oldText, ec);
+        m_textNode->replaceWholeText(m_oldText);
         return true;
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionCode&)
     {
-        m_textNode->replaceWholeText(m_text, ec);
+        m_textNode->replaceWholeText(m_text);
         return true;
     }
 
diff --git a/Source/core/inspector/InspectorAgent.cpp b/Source/core/inspector/InspectorAgent.cpp
index 0cff786..faf2ea0 100644
--- a/Source/core/inspector/InspectorAgent.cpp
+++ b/Source/core/inspector/InspectorAgent.cpp
@@ -51,7 +51,7 @@
 #include "core/page/Settings.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/network/ResourceRequest.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 using namespace std;
 
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index f390b7d..02b994a 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -54,6 +54,7 @@
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InspectorValues.h"
 #include "core/inspector/InstrumentingAgents.h"
+#include "core/loader/cache/CachedResource.h"
 #include "core/page/ContentSecurityPolicy.h"
 #include "core/page/DOMWindow.h"
 #include "core/rendering/RenderRegion.h"
diff --git a/Source/core/inspector/InspectorClient.h b/Source/core/inspector/InspectorClient.h
index 2b95404..97f7cb3 100644
--- a/Source/core/inspector/InspectorClient.h
+++ b/Source/core/inspector/InspectorClient.h
@@ -38,6 +38,7 @@
 class InspectorFrontendChannel;
 class Frame;
 class Page;
+class PlatformKeyboardEvent;
 
 class InspectorClient : public InspectorStateClient {
 public:
@@ -69,6 +70,8 @@
     virtual void getAllocatedObjects(HashSet<const void*>&) { }
     virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&) { }
 
+    virtual void dispatchKeyEvent(const PlatformKeyboardEvent&) { }
+
     static bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
 
 protected:
diff --git a/Source/core/inspector/InspectorConsoleAgent.cpp b/Source/core/inspector/InspectorConsoleAgent.cpp
index 1aff9ac..38e581e 100644
--- a/Source/core/inspector/InspectorConsoleAgent.cpp
+++ b/Source/core/inspector/InspectorConsoleAgent.cpp
@@ -177,10 +177,6 @@
         clearMessages(&error);
     }
 
-    // Ignore errors like "*property=value". This trick is used for IE7: http://stackoverflow.com/questions/4563651/what-does-an-asterisk-do-in-a-css-property-name
-    if (source == CSSMessageSource && message.contains(": *"))
-        return;
-
     bool canGenerateCallStack = !isWorkerAgent() && m_frontend;
     addConsoleMessage(adoptPtr(new ConsoleMessage(canGenerateCallStack, source, type, level, message, scriptId, lineNumber, state, requestIdentifier)));
 }
diff --git a/Source/core/inspector/InspectorController.cpp b/Source/core/inspector/InspectorController.cpp
index 1b4a7ad..07fe461 100644
--- a/Source/core/inspector/InspectorController.cpp
+++ b/Source/core/inspector/InspectorController.cpp
@@ -119,7 +119,7 @@
     m_memoryAgent = memoryAgentPtr.get();
     m_agents.append(memoryAgentPtr.release());
 
-    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_memoryAgent, m_state.get(), InspectorTimelineAgent::PageInspector,
+    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_memoryAgent, m_domAgent, m_state.get(), InspectorTimelineAgent::PageInspector,
        inspectorClient));
     m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent));
 
@@ -154,7 +154,7 @@
 
     m_agents.append(InspectorCanvasAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent, m_injectedScriptManager.get()));
 
-    m_agents.append(InspectorInputAgent::create(m_instrumentingAgents.get(), m_state.get(), page));
+    m_agents.append(InspectorInputAgent::create(m_instrumentingAgents.get(), m_state.get(), page, inspectorClient));
 
     m_agents.append(InspectorLayerTreeAgent::create(m_instrumentingAgents.get(), m_state.get()));
 
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index 1ceb90c..508312a 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -51,7 +51,6 @@
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/DocumentType.h"
 #include "core/dom/Element.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventContext.h"
 #include "core/dom/EventListener.h"
@@ -61,8 +60,9 @@
 #include "core/dom/Node.h"
 #include "core/dom/NodeList.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/fileapi/File.h"
 #include "core/fileapi/FileList.h"
 #include "core/html/HTMLElement.h"
@@ -179,7 +179,7 @@
     HitTestRequest request(hitType);
     HitTestResult result(frame->view()->windowToContents(point));
     frame->contentRenderer()->hitTest(request, result);
-    result.setToNonShadowAncestor();
+    result.setToShadowHostIfInUserAgentShadowRoot();
     Node* node = result.innerNode();
     while (node && node->nodeType() == Node::TEXT_NODE)
         node = node->parentNode();
@@ -316,12 +316,8 @@
 
 void InspectorDOMAgent::reset()
 {
-    if (m_history)
-        m_history->reset();
-    m_searchResults.clear();
-    discardBindings();
-    if (m_revalidateStyleAttrTask)
-        m_revalidateStyleAttrTask->reset();
+    discardFrontendBindings();
+    discardBackendBindings();
     m_document = 0;
 }
 
@@ -476,10 +472,7 @@
         return;
     }
 
-    // Reset backend state.
-    RefPtr<Document> doc = m_document;
-    reset();
-    m_document = doc;
+    discardFrontendBindings();
 
     root = buildObjectForNode(m_document.get(), 2, &m_documentNodeToIdMap);
 }
@@ -511,12 +504,21 @@
     m_frontend->setChildNodes(nodeId, children.release());
 }
 
-void InspectorDOMAgent::discardBindings()
+void InspectorDOMAgent::discardFrontendBindings()
 {
+    if (m_history)
+        m_history->reset();
+    m_searchResults.clear();
     m_documentNodeToIdMap.clear();
     m_idToNode.clear();
     releaseDanglingNodes();
     m_childrenRequested.clear();
+    if (m_revalidateStyleAttrTask)
+        m_revalidateStyleAttrTask->reset();
+}
+
+void InspectorDOMAgent::discardBackendBindings()
+{
     m_backendIdToNode.clear();
     m_nodeGroupToBackendIdMap.clear();
 }
@@ -698,38 +700,39 @@
     if (!element)
         return;
 
-    RefPtr<HTMLElement> parsedElement = createHTMLElement(element->document(), spanTag);
-    ExceptionCode ec = 0;
-    parsedElement.get()->setInnerHTML("<span " + text + "></span>", ec);
-    if (ec) {
-        *errorString = InspectorDOMAgent::toErrorString(ec);
-        return;
-    }
+    String markup = "<span " + text + "></span>";
+    RefPtr<DocumentFragment> fragment = element->document()->createDocumentFragment();
+    fragment->parseXML(markup, 0, DisallowScriptingContent);
 
-    Node* child = parsedElement->firstChild();
-    if (!child) {
+    Element* parsedElement = fragment->firstChild() && fragment->firstChild()->isElementNode() ? toElement(fragment->firstChild()) : 0;
+    if (!parsedElement) {
         *errorString = "Could not parse value as attributes";
         return;
     }
 
-    Element* childElement = toElement(child);
-    if (!childElement->hasAttributes() && name) {
-        m_domEditor->removeAttribute(element, *name, errorString);
+    bool shouldIgnoreCase = element->document()->isHTMLDocument() && element->isHTMLElement();
+    String caseAdjustedName = name ? (shouldIgnoreCase ? name->lower() : *name) : String();
+
+    if (!parsedElement->hasAttributes() && name) {
+        m_domEditor->removeAttribute(element, caseAdjustedName, errorString);
         return;
     }
 
     bool foundOriginalAttribute = false;
-    unsigned numAttrs = childElement->attributeCount();
+    unsigned numAttrs = parsedElement->attributeCount();
     for (unsigned i = 0; i < numAttrs; ++i) {
         // Add attribute pair
-        const Attribute* attribute = childElement->attributeItem(i);
-        foundOriginalAttribute = foundOriginalAttribute || (name && attribute->name().toString() == *name);
-        if (!m_domEditor->setAttribute(element, attribute->name().toString(), attribute->value(), errorString))
+        const Attribute* attribute = parsedElement->attributeItem(i);
+        String attributeName = attribute->name().toString();
+        if (shouldIgnoreCase)
+            attributeName = attributeName.lower();
+        foundOriginalAttribute |= name && attributeName == caseAdjustedName;
+        if (!m_domEditor->setAttribute(element, attributeName, attribute->value(), errorString))
             return;
     }
 
     if (!foundOriginalAttribute && name && !name->stripWhiteSpace().isEmpty())
-        m_domEditor->removeAttribute(element, *name, errorString);
+        m_domEditor->removeAttribute(element, caseAdjustedName, errorString);
 }
 
 void InspectorDOMAgent::removeAttribute(ErrorString* errorString, int elementId, const String& name)
@@ -1581,7 +1584,7 @@
 void InspectorDOMAgent::mainFrameDOMContentLoaded()
 {
     // Re-push document once it is loaded.
-    discardBindings();
+    discardFrontendBindings();
     if (m_state->getBoolean(DOMAgentState::documentRequested))
         m_frontend->documentUpdated();
 }
diff --git a/Source/core/inspector/InspectorDOMAgent.h b/Source/core/inspector/InspectorDOMAgent.h
index 219622a..aa0ef09 100644
--- a/Source/core/inspector/InspectorDOMAgent.h
+++ b/Source/core/inspector/InspectorDOMAgent.h
@@ -238,7 +238,8 @@
 
     Node* nodeForPath(const String& path);
 
-    void discardBindings();
+    void discardBackendBindings();
+    void discardFrontendBindings();
 
     void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor);
 
diff --git a/Source/core/inspector/InspectorDOMStorageAgent.cpp b/Source/core/inspector/InspectorDOMStorageAgent.cpp
index 41bb1e3..c9182ae 100644
--- a/Source/core/inspector/InspectorDOMStorageAgent.cpp
+++ b/Source/core/inspector/InspectorDOMStorageAgent.cpp
@@ -48,7 +48,7 @@
 #include "core/storage/StorageArea.h"
 #include "core/storage/StorageNamespace.h"
 #include "modules/webdatabase/Database.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #include <wtf/MemoryInstrumentationHashMap.h>
 #include <wtf/Vector.h>
diff --git a/Source/core/inspector/InspectorFileSystemAgent.cpp b/Source/core/inspector/InspectorFileSystemAgent.cpp
index bc99100..f360ad4 100644
--- a/Source/core/inspector/InspectorFileSystemAgent.cpp
+++ b/Source/core/inspector/InspectorFileSystemAgent.cpp
@@ -60,7 +60,7 @@
 #include "modules/filesystem/LocalFileSystem.h"
 #include "modules/filesystem/Metadata.h"
 #include "modules/filesystem/MetadataCallback.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include "wtf/ArrayBuffer.h"
 #include "wtf/text/Base64.h"
 #include "wtf/text/TextEncoding.h"
diff --git a/Source/core/inspector/InspectorIndexedDBAgent.cpp b/Source/core/inspector/InspectorIndexedDBAgent.cpp
index 7166c2b..ceacdc8 100644
--- a/Source/core/inspector/InspectorIndexedDBAgent.cpp
+++ b/Source/core/inspector/InspectorIndexedDBAgent.cpp
@@ -63,7 +63,7 @@
 #include "modules/indexeddb/IDBPendingTransactionMonitor.h"
 #include "modules/indexeddb/IDBRequest.h"
 #include "modules/indexeddb/IDBTransaction.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #include <wtf/Vector.h>
 
diff --git a/Source/core/inspector/InspectorInputAgent.cpp b/Source/core/inspector/InspectorInputAgent.cpp
index 0292338..f0f3496 100644
--- a/Source/core/inspector/InspectorInputAgent.cpp
+++ b/Source/core/inspector/InspectorInputAgent.cpp
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "core/inspector/InspectorInputAgent.h"
 
+#include "core/inspector/InspectorClient.h"
 #include "core/page/Chrome.h"
 #include "core/page/EventHandler.h"
 #include "core/page/FocusController.h"
@@ -49,9 +50,9 @@
 
 namespace WebCore {
 
-InspectorInputAgent::InspectorInputAgent(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* inspectorState, Page* page)
+InspectorInputAgent::InspectorInputAgent(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* inspectorState, Page* page, InspectorClient* client)
     : InspectorBaseAgent<InspectorInputAgent>("Input", instrumentingAgents, inspectorState)
-    , m_page(page)
+    , m_page(page), m_client(client)
 {
 }
 
@@ -88,7 +89,7 @@
         isSystemKey ? *isSystemKey : false,
         static_cast<PlatformEvent::Modifiers>(modifiers ? *modifiers : 0),
         timestamp ? *timestamp : currentTime());
-    m_page->focusController()->focusedOrMainFrame()->eventHandler()->keyEvent(event);
+    m_client->dispatchKeyEvent(event);
 }
 
 void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& type, int x, int y, const int* modifiers, const double* timestamp, const String* button, const int* clickCount)
diff --git a/Source/core/inspector/InspectorInputAgent.h b/Source/core/inspector/InspectorInputAgent.h
index fbb5d36..d329529 100644
--- a/Source/core/inspector/InspectorInputAgent.h
+++ b/Source/core/inspector/InspectorInputAgent.h
@@ -39,6 +39,7 @@
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
+class InspectorClient;
 class InspectorState;
 class Page;
 
@@ -47,9 +48,9 @@
 class InspectorInputAgent : public InspectorBaseAgent<InspectorInputAgent>, public InspectorBackendDispatcher::InputCommandHandler {
     WTF_MAKE_NONCOPYABLE(InspectorInputAgent);
 public:
-    static PassOwnPtr<InspectorInputAgent> create(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* inspectorState, Page* page)
+    static PassOwnPtr<InspectorInputAgent> create(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* inspectorState, Page* page, InspectorClient* client)
     {
-        return adoptPtr(new InspectorInputAgent(instrumentingAgents, inspectorState, page));
+        return adoptPtr(new InspectorInputAgent(instrumentingAgents, inspectorState, page, client));
     }
 
     ~InspectorInputAgent();
@@ -59,9 +60,10 @@
     virtual void dispatchMouseEvent(ErrorString*, const String& type, int x, int y, const int* modifiers, const double* timestamp, const String* button, const int* clickCount);
 
 private:
-    InspectorInputAgent(InstrumentingAgents*, InspectorCompositeState*, Page*);
+    InspectorInputAgent(InstrumentingAgents*, InspectorCompositeState*, Page*, InspectorClient*);
 
     Page* m_page;
+    InspectorClient* m_client;
 };
 
 
diff --git a/Source/core/inspector/InspectorInstrumentation.cpp b/Source/core/inspector/InspectorInstrumentation.cpp
index 3acd738..6631f98 100644
--- a/Source/core/inspector/InspectorInstrumentation.cpp
+++ b/Source/core/inspector/InspectorInstrumentation.cpp
@@ -33,6 +33,7 @@
 
 #include "bindings/v8/DOMWrapperWorld.h"
 #include "bindings/v8/ScriptController.h"
+#include "core/css/CSSParser.h"
 #include "core/css/CSSRule.h"
 #include "core/css/CSSStyleRule.h"
 #include "core/css/StyleRule.h"
@@ -1311,11 +1312,21 @@
         layerTreeAgent->pseudoElementDestroyed(pseudoElement);
 }
 
+bool cssErrorFilter(const CSSParserLocation& location, int errorType)
+{
+    // Ignore errors like "*property: value". This trick is used for IE7: http://stackoverflow.com/questions/4563651/what-does-an-asterisk-do-in-a-css-property-name
+    if (errorType == CSSParser::PropertyDeclarationError && location.token.length() > 0 && location.token[0] == '*')
+        return false;
+
+    return true;
+}
+
 } // namespace InspectorInstrumentation
 
 namespace InstrumentationEvents {
 const char PaintLayer[] = "PaintLayer";
 const char RasterTask[] = "RasterTask";
+const char ImageDecodeTask[] = "ImageDecodeTask";
 const char Paint[] = "Paint";
 const char Layer[] = "Layer";
 const char BeginFrame[] = "BeginFrame";
diff --git a/Source/core/inspector/InspectorInstrumentation.h b/Source/core/inspector/InspectorInstrumentation.h
index df4e588..972b442 100644
--- a/Source/core/inspector/InspectorInstrumentation.h
+++ b/Source/core/inspector/InspectorInstrumentation.h
@@ -55,6 +55,7 @@
 
 namespace WebCore {
 
+class CSSParserLocation;
 class CSSRule;
 class CachedResource;
 class CharacterData;
@@ -148,6 +149,7 @@
 namespace InstrumentationEvents {
 extern const char PaintLayer[];
 extern const char RasterTask[];
+extern const char ImageDecodeTask[];
 extern const char Paint[];
 extern const char Layer[];
 extern const char BeginFrame[];
@@ -192,6 +194,8 @@
     return instrumentingAgentsForDocument(element->document());
 }
 
+bool cssErrorFilter(const CSSParserLocation&, int errorType);
+
 } // namespace InspectorInstrumentation
 
 } // namespace WebCore
diff --git a/Source/core/inspector/InspectorOverlayPage.html b/Source/core/inspector/InspectorOverlayPage.html
index 503aeb4..965c845 100644
--- a/Source/core/inspector/InspectorOverlayPage.html
+++ b/Source/core/inspector/InspectorOverlayPage.html
@@ -354,12 +354,10 @@
     var frameWidth = frameViewFullSize.width || canvasWidth;
     var textWidth = context.measureText(text).width;
     context.fillStyle = gridBackgroundColor;
-    context.fillRect(frameWidth - textWidth - 12, 15, frameWidth, 25);
+    context.fillRect(frameWidth - textWidth - 12, 0, frameWidth, 25);
     context.fillStyle = darkGridColor;
-    context.fillText(text, frameWidth - textWidth - 6, 33);
+    context.fillText(text, frameWidth - textWidth - 6, 18);
     context.restore();
-
-    _drawGrid(false, false);
 }
 
 function reset(resetData)
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index 4965c24..94d0215 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -71,7 +71,7 @@
 #include "core/platform/text/RegularExpression.h"
 #include "modules/geolocation/GeolocationController.h"
 #include "modules/geolocation/GeolocationError.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/inspector/InspectorPageAgent.h b/Source/core/inspector/InspectorPageAgent.h
index 6d9cf83..212eb51 100644
--- a/Source/core/inspector/InspectorPageAgent.h
+++ b/Source/core/inspector/InspectorPageAgent.h
@@ -35,7 +35,6 @@
 #include "InspectorFrontend.h"
 #include "core/dom/DeviceOrientationData.h"
 #include "core/inspector/InspectorBaseAgent.h"
-#include "core/page/Frame.h"
 #include "modules/geolocation/GeolocationPosition.h"
 #include <wtf/HashMap.h>
 #include <wtf/RefCounted.h>
@@ -48,22 +47,18 @@
 class DOMWrapperWorld;
 class DocumentLoader;
 class Frame;
-class Frontend;
 class GraphicsContext;
 class InjectedScriptManager;
 class InspectorAgent;
-class InspectorArray;
 class InspectorClient;
-class InspectorObject;
 class InspectorOverlay;
-class InspectorState;
 class InstrumentingAgents;
+class IntSize;
 class KURL;
+class LayoutRect;
 class Page;
 class RenderObject;
-class RegularExpression;
 class SharedBuffer;
-class TextResourceDecoder;
 
 typedef String ErrorString;
 
diff --git a/Source/core/inspector/InspectorTimelineAgent.cpp b/Source/core/inspector/InspectorTimelineAgent.cpp
index bf18d07..d2b90fc 100644
--- a/Source/core/inspector/InspectorTimelineAgent.cpp
+++ b/Source/core/inspector/InspectorTimelineAgent.cpp
@@ -36,6 +36,7 @@
 #include "core/inspector/IdentifiersFactory.h"
 #include "core/inspector/InspectorClient.h"
 #include "core/inspector/InspectorCounters.h"
+#include "core/inspector/InspectorDOMAgent.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/inspector/InspectorMemoryAgent.h"
 #include "core/inspector/InspectorPageAgent.h"
@@ -122,6 +123,10 @@
 const char Rasterize[] = "Rasterize";
 }
 
+namespace {
+const char BackendNodeIdGroup[] = "timeline";
+}
+
 static Frame* frameForScriptExecutionContext(ScriptExecutionContext* context)
 {
     Frame* frame = 0;
@@ -173,7 +178,6 @@
 
 InspectorTimelineAgent::~InspectorTimelineAgent()
 {
-    clearFrontend();
 }
 
 void InspectorTimelineAgent::setFrontend(InspectorFrontend* frontend)
@@ -185,6 +189,7 @@
 {
     ErrorString error;
     stop(&error);
+    releaseNodeIds();
     m_frontend = 0;
 }
 
@@ -204,6 +209,7 @@
     if (!m_frontend)
         return;
 
+    releaseNodeIds();
     if (maxCallStackDepth && *maxCallStackDepth >= 0)
         m_maxCallStackDepth = *maxCallStackDepth;
     else
@@ -319,7 +325,7 @@
     Vector<FloatQuad> quads;
     root->absoluteQuads(quads);
     if (quads.size() >= 1)
-        TimelineRecordFactory::appendLayoutRoot(entry.data.get(), quads[0]);
+        TimelineRecordFactory::appendLayoutRoot(entry.data.get(), quads[0], idForNode(root->generatingNode()));
     else
         ASSERT_NOT_REACHED();
     didCompleteCurrentRecord(TimelineRecordType::Layout);
@@ -364,7 +370,7 @@
     ASSERT(entry.type == TimelineRecordType::Paint);
     FloatQuad quad;
     localToPageQuad(*renderer, clipRect, &quad);
-    entry.data = TimelineRecordFactory::createPaintData(quad);
+    entry.data = TimelineRecordFactory::createPaintData(quad, idForNode(renderer->generatingNode()));
     didCompleteCurrentRecord(TimelineRecordType::Paint);
 }
 
@@ -711,10 +717,11 @@
     }
 }
 
-InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorMemoryAgent* memoryAgent, InspectorCompositeState* state, InspectorType type, InspectorClient* client)
+InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorMemoryAgent* memoryAgent, InspectorDOMAgent* domAgent, InspectorCompositeState* state, InspectorType type, InspectorClient* client)
     : InspectorBaseAgent<InspectorTimelineAgent>("Timeline", instrumentingAgents, state)
     , m_pageAgent(pageAgent)
     , m_memoryAgent(memoryAgent)
+    , m_domAgent(domAgent)
     , m_frontend(0)
     , m_id(1)
     , m_maxCallStackDepth(5)
@@ -786,6 +793,18 @@
     quad->setP4(view->contentsToRootView(roundedIntPoint(absolute.p4())));
 }
 
+int InspectorTimelineAgent::idForNode(Node* node)
+{
+    return m_domAgent && node ? m_domAgent->backendNodeIdForNode(node, BackendNodeIdGroup) : 0;
+}
+
+void InspectorTimelineAgent::releaseNodeIds()
+{
+    ErrorString unused;
+    if (m_domAgent)
+        m_domAgent->releaseBackendNodeIds(&unused, BackendNodeIdGroup);
+}
+
 double InspectorTimelineAgent::timestamp()
 {
     return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyIncreasingTime());
diff --git a/Source/core/inspector/InspectorTimelineAgent.h b/Source/core/inspector/InspectorTimelineAgent.h
index 62d0de9..ccfe4ea 100644
--- a/Source/core/inspector/InspectorTimelineAgent.h
+++ b/Source/core/inspector/InspectorTimelineAgent.h
@@ -53,6 +53,7 @@
 class Frame;
 class GraphicsContext;
 class InspectorClient;
+class InspectorDOMAgent;
 class InspectorFrontend;
 class InspectorMemoryAgent;
 class InspectorPageAgent;
@@ -102,9 +103,9 @@
 public:
     enum InspectorType { PageInspector, WorkerInspector };
 
-    static PassOwnPtr<InspectorTimelineAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorMemoryAgent* memoryAgent, InspectorCompositeState* state, InspectorType type, InspectorClient* client)
+    static PassOwnPtr<InspectorTimelineAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorMemoryAgent* memoryAgent, InspectorDOMAgent* domAgent, InspectorCompositeState* state, InspectorType type, InspectorClient* client)
     {
-        return adoptPtr(new InspectorTimelineAgent(instrumentingAgents, pageAgent, memoryAgent, state, type, client));
+        return adoptPtr(new InspectorTimelineAgent(instrumentingAgents, pageAgent, memoryAgent, domAgent, state, type, client));
     }
 
     ~InspectorTimelineAgent();
@@ -220,7 +221,7 @@
         size_t usedHeapSizeAtStart;
     };
         
-    InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorMemoryAgent*, InspectorCompositeState*, InspectorType, InspectorClient*);
+    InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorMemoryAgent*, InspectorDOMAgent*, InspectorCompositeState*, InspectorType, InspectorClient*);
 
     void sendEvent(PassRefPtr<InspectorObject>);
     void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame*);
@@ -242,11 +243,15 @@
 
     void localToPageQuad(const RenderObject& renderer, const LayoutRect&, FloatQuad*);
     const TimelineTimeConverter& timeConverter() const { return m_timeConverter; }
+    int idForNode(Node*);
+    void releaseNodeIds();
+
     double timestamp();
     Page* page();
 
     InspectorPageAgent* m_pageAgent;
     InspectorMemoryAgent* m_memoryAgent;
+    InspectorDOMAgent* m_domAgent;
     TimelineTimeConverter m_timeConverter;
 
     InspectorFrontend::Timeline* m_frontend;
diff --git a/Source/core/inspector/NetworkResourcesData.h b/Source/core/inspector/NetworkResourcesData.h
index 4394a91..91beeef 100644
--- a/Source/core/inspector/NetworkResourcesData.h
+++ b/Source/core/inspector/NetworkResourcesData.h
@@ -31,6 +31,7 @@
 
 #include "core/inspector/InspectorPageAgent.h"
 #include "core/loader/TextResourceDecoder.h"
+#include "core/platform/KURL.h"
 #include "core/platform/network/HTTPHeaderMap.h"
 #include <wtf/Deque.h>
 #include <wtf/HashMap.h>
@@ -43,6 +44,7 @@
 
 class CachedResource;
 class FormData;
+class ResourceResponse;
 class SharedBuffer;
 class TextResourceDecoder;
 
diff --git a/Source/core/inspector/PageRuntimeAgent.cpp b/Source/core/inspector/PageRuntimeAgent.cpp
index 43beb6e..5d26918 100644
--- a/Source/core/inspector/PageRuntimeAgent.cpp
+++ b/Source/core/inspector/PageRuntimeAgent.cpp
@@ -38,9 +38,10 @@
 #include "core/inspector/InspectorPageAgent.h"
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
+#include "core/page/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 using WebCore::TypeBuilder::Runtime::ExecutionContextDescription;
 
diff --git a/Source/core/inspector/TimelineRecordFactory.cpp b/Source/core/inspector/TimelineRecordFactory.cpp
index e82ce1a..2343cfb 100644
--- a/Source/core/inspector/TimelineRecordFactory.cpp
+++ b/Source/core/inspector/TimelineRecordFactory.cpp
@@ -234,16 +234,20 @@
     return array.release();
 }
 
-PassRefPtr<InspectorObject> TimelineRecordFactory::createPaintData(const FloatQuad& quad)
+PassRefPtr<InspectorObject> TimelineRecordFactory::createPaintData(const FloatQuad& quad, int layerRootNodeId)
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
     data->setArray("clip", createQuad(quad));
+    if (layerRootNodeId)
+        data->setNumber("layerRootNode", layerRootNodeId);
     return data.release();
 }
 
-void TimelineRecordFactory::appendLayoutRoot(InspectorObject* data, const FloatQuad& quad)
+void TimelineRecordFactory::appendLayoutRoot(InspectorObject* data, const FloatQuad& quad, int rootNodeId)
 {
     data->setArray("root", createQuad(quad));
+    if (rootNodeId)
+        data->setNumber("rootNode", rootNodeId);
 }
 
 void TimelineRecordFactory::appendStyleRecalcDetails(InspectorObject* data, unsigned elementCount)
diff --git a/Source/core/inspector/TimelineRecordFactory.h b/Source/core/inspector/TimelineRecordFactory.h
index e13b61e..548daa0 100644
--- a/Source/core/inspector/TimelineRecordFactory.h
+++ b/Source/core/inspector/TimelineRecordFactory.h
@@ -92,9 +92,9 @@
 
         static PassRefPtr<InspectorObject> createAnimationFrameData(int callbackId);
 
-        static PassRefPtr<InspectorObject> createPaintData(const FloatQuad&);
+        static PassRefPtr<InspectorObject> createPaintData(const FloatQuad&, int layerRootNodeId);
 
-        static void appendLayoutRoot(InspectorObject* data, const FloatQuad&);
+        static void appendLayoutRoot(InspectorObject* data, const FloatQuad&, int rootNodeId);
 
         static void appendStyleRecalcDetails(InspectorObject* data, unsigned elementCount);
 
diff --git a/Source/core/inspector/TimelineTraceEventProcessor.cpp b/Source/core/inspector/TimelineTraceEventProcessor.cpp
index 83550b9..3b93b5b 100644
--- a/Source/core/inspector/TimelineTraceEventProcessor.cpp
+++ b/Source/core/inspector/TimelineTraceEventProcessor.cpp
@@ -160,6 +160,8 @@
     registerHandler(InstrumentationEvents::PaintLayer, TracePhaseEnd, &TimelineTraceEventProcessor::onPaintLayerEnd);
     registerHandler(InstrumentationEvents::RasterTask, TracePhaseBegin, &TimelineTraceEventProcessor::onRasterTaskBegin);
     registerHandler(InstrumentationEvents::RasterTask, TracePhaseEnd, &TimelineTraceEventProcessor::onRasterTaskEnd);
+    registerHandler(InstrumentationEvents::ImageDecodeTask, TracePhaseBegin, &TimelineTraceEventProcessor::onImageDecodeTaskBegin);
+    registerHandler(InstrumentationEvents::ImageDecodeTask, TracePhaseEnd, &TimelineTraceEventProcessor::onImageDecodeTaskEnd);
     registerHandler(InstrumentationEvents::Layer, TracePhaseDeleteObject, &TimelineTraceEventProcessor::onLayerDeleted);
     registerHandler(InstrumentationEvents::Paint, TracePhaseInstant, &TimelineTraceEventProcessor::onPaint);
     registerHandler(PlatformInstrumentation::ImageDecodeEvent, TracePhaseBegin, &TimelineTraceEventProcessor::onImageDecodeBegin);
@@ -238,12 +240,9 @@
 
 void TimelineTraceEventProcessor::onRasterTaskBegin(const TraceEvent& event)
 {
-    unsigned long long layerId = event.asUInt(InstrumentationEventArguments::LayerId);
-    if (!m_knownLayers.contains(layerId))
-        return;
     TimelineThreadState& state = threadState(event.threadIdentifier());
-    ASSERT(!state.inRasterizeEvent);
-    state.inRasterizeEvent = true;
+    if (!maybeEnterLayerTask(event, state))
+        return;
     RefPtr<InspectorObject> record = createRecord(event, TimelineRecordType::Rasterize);
     state.recordStack.addScopedRecord(record.release());
 }
@@ -251,17 +250,42 @@
 void TimelineTraceEventProcessor::onRasterTaskEnd(const TraceEvent& event)
 {
     TimelineThreadState& state = threadState(event.threadIdentifier());
-    if (!state.inRasterizeEvent)
+    if (!state.inKnownLayerTask)
         return;
     ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::Rasterize));
     state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp()));
-    state.inRasterizeEvent = false;
+    leaveLayerTask(state);
+}
+
+void TimelineTraceEventProcessor::onImageDecodeTaskBegin(const TraceEvent& event)
+{
+    maybeEnterLayerTask(event, threadState(event.threadIdentifier()));
+}
+
+void TimelineTraceEventProcessor::onImageDecodeTaskEnd(const TraceEvent& event)
+{
+    leaveLayerTask(threadState(event.threadIdentifier()));
+}
+
+bool TimelineTraceEventProcessor::maybeEnterLayerTask(const TraceEvent& event, TimelineThreadState& threadState)
+{
+    unsigned long long layerId = event.asUInt(InstrumentationEventArguments::LayerId);
+    if (!m_knownLayers.contains(layerId))
+        return false;
+    ASSERT(!threadState.inKnownLayerTask);
+    threadState.inKnownLayerTask = true;
+    return true;
+}
+
+void TimelineTraceEventProcessor::leaveLayerTask(TimelineThreadState& threadState)
+{
+    threadState.inKnownLayerTask = false;
 }
 
 void TimelineTraceEventProcessor::onImageDecodeBegin(const TraceEvent& event)
 {
     TimelineThreadState& state = threadState(event.threadIdentifier());
-    if (!state.inRasterizeEvent)
+    if (!state.inKnownLayerTask)
         return;
     state.recordStack.addScopedRecord(createRecord(event, TimelineRecordType::DecodeImage));
 }
@@ -269,7 +293,7 @@
 void TimelineTraceEventProcessor::onImageDecodeEnd(const TraceEvent& event)
 {
     TimelineThreadState& state = threadState(event.threadIdentifier());
-    if (!state.inRasterizeEvent)
+    if (!state.inKnownLayerTask)
         return;
     ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::DecodeImage));
     state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp()));
diff --git a/Source/core/inspector/TimelineTraceEventProcessor.h b/Source/core/inspector/TimelineTraceEventProcessor.h
index 67760d2..10b45be 100644
--- a/Source/core/inspector/TimelineTraceEventProcessor.h
+++ b/Source/core/inspector/TimelineTraceEventProcessor.h
@@ -126,12 +126,12 @@
 
         TimelineThreadState(WeakPtr<InspectorTimelineAgent> timelineAgent)
             : recordStack(timelineAgent)
-            , inRasterizeEvent(false)
+            , inKnownLayerTask(false)
         {
         }
 
         TimelineRecordStack recordStack;
-        bool inRasterizeEvent;
+        bool inKnownLayerTask;
     };
 
     class TraceEvent {
@@ -222,6 +222,8 @@
             return it->value;
         return m_threadStates.add(thread, TimelineThreadState(m_timelineAgent)).iterator->value;
     }
+    bool maybeEnterLayerTask(const TraceEvent&, TimelineThreadState&);
+    void leaveLayerTask(TimelineThreadState&);
 
     void processBackgroundEvents();
     PassRefPtr<InspectorObject> createRecord(const TraceEvent&, const String& recordType, PassRefPtr<InspectorObject> data = 0);
@@ -233,6 +235,8 @@
     void onPaintLayerEnd(const TraceEvent&);
     void onRasterTaskBegin(const TraceEvent&);
     void onRasterTaskEnd(const TraceEvent&);
+    void onImageDecodeTaskBegin(const TraceEvent&);
+    void onImageDecodeTaskEnd(const TraceEvent&);
     void onImageDecodeBegin(const TraceEvent&);
     void onImageDecodeEnd(const TraceEvent&);
     void onLayerDeleted(const TraceEvent&);
diff --git a/Source/core/inspector/WorkerInspectorController.cpp b/Source/core/inspector/WorkerInspectorController.cpp
index 21994ea..1f15fd8 100644
--- a/Source/core/inspector/WorkerInspectorController.cpp
+++ b/Source/core/inspector/WorkerInspectorController.cpp
@@ -108,7 +108,7 @@
 
     m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent.get(), workerContext, m_state.get(), m_injectedScriptManager.get()));
     m_agents.append(InspectorHeapProfilerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get()));
-    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), 0, 0, m_state.get(), InspectorTimelineAgent::WorkerInspector, 0));
+    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), 0, 0, 0, m_state.get(), InspectorTimelineAgent::WorkerInspector, 0));
     m_agents.append(consoleAgent.release());
 
     m_injectedScriptManager->injectedScriptHost()->init(0
diff --git a/Source/core/loader/CrossOriginAccessControl.cpp b/Source/core/loader/CrossOriginAccessControl.cpp
index db496c7..e77bf5d 100644
--- a/Source/core/loader/CrossOriginAccessControl.cpp
+++ b/Source/core/loader/CrossOriginAccessControl.cpp
@@ -33,7 +33,7 @@
 #include "core/platform/network/HTTPParsers.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/DocumentLoadTiming.cpp b/Source/core/loader/DocumentLoadTiming.cpp
index 99defb6..fc6970c 100644
--- a/Source/core/loader/DocumentLoadTiming.cpp
+++ b/Source/core/loader/DocumentLoadTiming.cpp
@@ -32,7 +32,7 @@
 #include "core/loader/DocumentLoader.h"
 #include "core/page/Frame.h"
 #include "core/page/Page.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/DocumentLoader.cpp b/Source/core/loader/DocumentLoader.cpp
index 1aac7ce..b18718a 100644
--- a/Source/core/loader/DocumentLoader.cpp
+++ b/Source/core/loader/DocumentLoader.cpp
@@ -63,8 +63,8 @@
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/Logging.h"
-#include "origin/SchemeRegistry.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/SchemeRegistry.h"
+#include "weborigin/SecurityPolicy.h"
 
 namespace WebCore {
 
@@ -477,9 +477,9 @@
     if (newRequest.cachePolicy() == UseProtocolCachePolicy && isPostOrRedirectAfterPost(newRequest, redirectResponse))
         newRequest.setCachePolicy(ReloadIgnoringCacheData);
 
-    Frame* top = m_frame->tree()->top();
-    if (top != m_frame) {
-        if (!frameLoader()->mixedContentChecker()->canDisplayInsecureContent(top->document()->securityOrigin(), newRequest.url())) {
+    Frame* parent = m_frame->tree()->parent();
+    if (parent) {
+        if (!parent->loader()->mixedContentChecker()->canRunInsecureContent(parent->document()->securityOrigin(), newRequest.url())) {
             cancelMainResourceLoad(frameLoader()->cancelledError(newRequest));
             return;
         }
@@ -647,8 +647,6 @@
 
         if (frameLoader()->stateMachine()->creatingInitialEmptyDocument())
             return;
-        if (frameLoader()->stateMachine()->isDisplayingInitialEmptyDocument())
-            frameLoader()->stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
         
         // The origin is the MHTML file, we need to set the base URL to the document encoded in the MHTML so
         // relative URLs are resolved properly.
@@ -1077,7 +1075,7 @@
 
     ResourceRequest request(m_request);
     DEFINE_STATIC_LOCAL(ResourceLoaderOptions, mainResourceLoadOptions,
-        (SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck));
+        (SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck));
     CachedResourceRequest cachedResourceRequest(request, mainResourceLoadOptions);
     m_mainResource = m_cachedResourceLoader->requestMainResource(cachedResourceRequest);
     if (!m_mainResource) {
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp
index 58beed3..6f4a6be 100644
--- a/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/Source/core/loader/DocumentThreadableLoader.cpp
@@ -31,8 +31,7 @@
 #include "config.h"
 #include "core/loader/DocumentThreadableLoader.h"
 
-#include <wtf/Assertions.h>
-#include <wtf/UnusedParam.h>
+#include "bindings/v8/ScriptController.h"
 #include "core/dom/Document.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/CrossOriginAccessControl.h"
@@ -45,11 +44,15 @@
 #include "core/loader/cache/CachedRawResource.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
+#include "core/loader/cache/CachedResourceRequestInitiators.h"
+#include "core/page/ContentSecurityPolicy.h"
 #include "core/page/Frame.h"
 #include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
-#include "origin/SchemeRegistry.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SchemeRegistry.h"
+#include "weborigin/SecurityOrigin.h"
+#include "wtf/Assertions.h"
+#include "wtf/UnusedParam.h"
 
 namespace WebCore {
 
@@ -179,6 +182,12 @@
     ASSERT_UNUSED(resource, resource == m_resource);
 
     RefPtr<DocumentThreadableLoader> protect(this);
+    if (!isAllowedByPolicy(request.url())) {
+        m_client->didFailRedirectCheck();
+        request = ResourceRequest();
+        return;
+    }
+
     // Allow same origin requests to continue after allowing clients to audit the redirect.
     if (isAllowedRedirect(request.url())) {
         if (m_client->isDocumentThreadableLoaderClient())
@@ -187,7 +196,8 @@
     }
 
     // When using access control, only simple cross origin requests are allowed to redirect. The new request URL must have a supported
-    // scheme and not contain the userinfo production. In addition, the redirect response must pass the access control check.
+    // scheme and not contain the userinfo production. In addition, the redirect response must pass the access control check if the
+    // original request was not same-origin.
     if (m_options.crossOriginRequestPolicy == UseAccessControl) {
         bool allowRedirect = false;
         if (m_simpleRequest) {
@@ -195,7 +205,7 @@
             allowRedirect = SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())
                             && request.url().user().isEmpty()
                             && request.url().pass().isEmpty()
-                            && passesAccessControlCheck(redirectResponse, m_options.allowCredentials, securityOrigin(), accessControlErrorDescription);
+                            && (m_sameOriginRequest || passesAccessControlCheck(redirectResponse, m_options.allowCredentials, securityOrigin(), accessControlErrorDescription));
         }
 
         if (allowRedirect) {
@@ -204,12 +214,19 @@
 
             RefPtr<SecurityOrigin> originalOrigin = SecurityOrigin::createFromString(redirectResponse.url());
             RefPtr<SecurityOrigin> requestOrigin = SecurityOrigin::createFromString(request.url());
-            // If the request URL origin is not same origin with the original URL origin, set source origin to a globally unique identifier.
-            if (!originalOrigin->isSameSchemeHostPort(requestOrigin.get()))
+            // If the original request wasn't same-origin, then if the request URL origin is not same origin with the original URL origin,
+            // set the source origin to a globally unique identifier. (If the original request was same-origin, the origin of the new request
+            // should be the original URL origin.)
+            if (!m_sameOriginRequest && !originalOrigin->isSameSchemeHostPort(requestOrigin.get()))
                 m_options.securityOrigin = SecurityOrigin::createUnique();
             // Force any subsequent requests to use these checks.
             m_sameOriginRequest = false;
 
+            // Since the request is no longer same-origin, if the user didn't request credentials in
+            // the first place, update our state so we neither request them nor expect they must be allowed.
+            if (m_options.credentialsRequested == ClientDidNotRequestCredentials)
+                m_options.allowCredentials = DoNotAllowStoredCredentials;
+
             // Remove any headers that may have been added by the network layer that cause access control to fail.
             request.clearHTTPContentType();
             request.clearHTTPReferrer();
@@ -394,7 +411,7 @@
     unsigned long identifier = std::numeric_limits<unsigned long>::max();
     if (Frame* frame = m_document->frame()) {
         Frame* top = frame->tree()->top();
-        if (!top->loader()->mixedContentChecker()->canDisplayInsecureContent(top->document()->securityOrigin(), requestURL)) {
+        if (!top->loader()->mixedContentChecker()->canRunInsecureContent(top->document()->securityOrigin(), requestURL)) {
             m_client->didFail(error);
             return;
         }
@@ -413,7 +430,7 @@
     // FIXME: FrameLoader::loadSynchronously() does not tell us whether a redirect happened or not, so we guess by comparing the
     // request and response URLs. This isn't a perfect test though, since a server can serve a redirect to the same URL that was
     // requested. Also comparing the request and response URLs as strings will fail if the requestURL still has its credentials.
-    if (requestURL != response.url() && !isAllowedRedirect(response.url())) {
+    if (requestURL != response.url() && (!isAllowedByPolicy(response.url()) || !isAllowedRedirect(response.url()))) {
         m_client->didFailRedirectCheck();
         return;
     }
@@ -427,7 +444,7 @@
     didFinishLoading(identifier, 0.0);
 }
 
-bool DocumentThreadableLoader::isAllowedRedirect(const KURL& url)
+bool DocumentThreadableLoader::isAllowedRedirect(const KURL& url) const
 {
     if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
         return true;
@@ -435,6 +452,13 @@
     return m_sameOriginRequest && securityOrigin()->canRequest(url);
 }
 
+bool DocumentThreadableLoader::isAllowedByPolicy(const KURL& url) const
+{
+    if (m_options.contentSecurityPolicyEnforcement != EnforceConnectSrcDirective)
+        return true;
+    return m_document->contentSecurityPolicy()->allowConnectToSource(url);
+}
+
 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
 {
     return m_options.securityOrigin ? m_options.securityOrigin.get() : m_document->securityOrigin();
diff --git a/Source/core/loader/DocumentThreadableLoader.h b/Source/core/loader/DocumentThreadableLoader.h
index 32402b0..da0afb6 100644
--- a/Source/core/loader/DocumentThreadableLoader.h
+++ b/Source/core/loader/DocumentThreadableLoader.h
@@ -95,7 +95,8 @@
         void preflightFailure(unsigned long identifier, const String& url, const String& errorDescription);
 
         void loadRequest(const ResourceRequest&, SecurityCheckPolicy);
-        bool isAllowedRedirect(const KURL&);
+        bool isAllowedRedirect(const KURL&) const;
+        bool isAllowedByPolicy(const KURL&) const;
 
         SecurityOrigin* securityOrigin() const;
 
diff --git a/Source/core/loader/DocumentWriter.cpp b/Source/core/loader/DocumentWriter.cpp
index b29d7da..9232db8 100644
--- a/Source/core/loader/DocumentWriter.cpp
+++ b/Source/core/loader/DocumentWriter.cpp
@@ -44,7 +44,7 @@
 #include "core/page/FrameView.h"
 #include "core/page/Settings.h"
 #include "core/platform/text/SegmentedString.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/EmptyClients.h b/Source/core/loader/EmptyClients.h
index 5bc450f..137e8ec 100644
--- a/Source/core/loader/EmptyClients.h
+++ b/Source/core/loader/EmptyClients.h
@@ -139,7 +139,6 @@
     virtual WebKit::WebScreenInfo screenInfo() const OVERRIDE { return WebKit::WebScreenInfo(); }
     virtual void contentsSizeChanged(Frame*, const IntSize&) const OVERRIDE { }
 
-    virtual void scrollbarsModeDidChange() const OVERRIDE { }
     virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned) OVERRIDE { }
 
     virtual void setToolTip(const String&, TextDirection) OVERRIDE { }
diff --git a/Source/core/loader/FrameLoadRequest.h b/Source/core/loader/FrameLoadRequest.h
index 5e5185f..0d1c8cd 100644
--- a/Source/core/loader/FrameLoadRequest.h
+++ b/Source/core/loader/FrameLoadRequest.h
@@ -27,7 +27,7 @@
 #define FrameLoadRequest_h
 
 #include "core/loader/SubstituteData.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include "core/platform/network/ResourceRequest.h"
 
 namespace WebCore {
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index 10c9a76..c985192 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -104,9 +104,9 @@
 #include "core/plugins/PluginData.h"
 #include "core/xml/parser/XMLDocumentParser.h"
 #include "modules/webdatabase/DatabaseManager.h"
-#include "origin/SchemeRegistry.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/SchemeRegistry.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
 
 #if ENABLE(SVG)
 #include "SVGNames.h"
@@ -480,7 +480,7 @@
 
     // Calling document.open counts as committing the first real document load.
     if (!m_stateMachine.committedFirstRealDocumentLoad())
-        m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
+        m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
     
     // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results
     // from a subsequent window.document.open / window.document.write call. 
@@ -543,6 +543,9 @@
     m_checkTimer.stop();
     m_shouldCallCheckCompleted = false;
     m_shouldCallCheckLoadComplete = false;
+
+    if (m_stateMachine.isDisplayingInitialEmptyDocument() && m_stateMachine.committedFirstRealDocumentLoad())
+        m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
 }
 
 void FrameLoader::receivedFirstData()
@@ -774,7 +777,7 @@
     m_frame->document()->implicitClose();
 }
 
-void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer, Frame* childFrame)
+void FrameLoader::loadURLIntoChildFrame(const ResourceRequest& request, Frame* childFrame)
 {
     ASSERT(childFrame);
 
@@ -789,27 +792,7 @@
             return;
         }
     }
-
-    childFrame->loader()->loadURL(url, referer, "_self", FrameLoadTypeInitialInChildFrame, 0, 0);
-}
-
-ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const String& mimeTypeIn, bool shouldPreferPlugInsForImages)
-{
-    String mimeType = mimeTypeIn;
-
-    if (mimeType.isEmpty())
-        mimeType = mimeTypeFromURL(url);
-
-    if (mimeType.isEmpty())
-        return ObjectContentFrame; // Go ahead and hope that we can display the content.
-
-    if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
-        return WebCore::ObjectContentImage;
-
-    if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
-        return WebCore::ObjectContentFrame;
-
-    return WebCore::ObjectContentNone;
+    childFrame->loader()->loadURL(request, "_self", FrameLoadTypeInitialInChildFrame, 0, 0);
 }
 
 String FrameLoader::outgoingReferrer() const
@@ -990,6 +973,7 @@
         frame()->page()->backForward()->setCurrentItem(currentItem.get());
 
         ASSERT(stateMachine()->isDisplayingInitialEmptyDocument());
+        stateMachine()->advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
         stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
     }
 }
@@ -1028,26 +1012,34 @@
         return;
     }
 
-    String argsReferrer = request.resourceRequest().httpReferrer();
+    ResourceRequest resourceRequest(request.resourceRequest());
+    String argsReferrer = resourceRequest.httpReferrer();
     if (argsReferrer.isEmpty())
         argsReferrer = outgoingReferrer();
 
     String referrer = SecurityPolicy::generateReferrerHeader(m_frame->document()->referrerPolicy(), url, argsReferrer);
     if (shouldSendReferrer == NeverSendReferrer)
         referrer = String();
-    
+
+    if (!referrer.isEmpty()) {
+        resourceRequest.setHTTPReferrer(referrer);
+        RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString(referrer);
+        addHTTPOriginIfNeeded(resourceRequest, referrerOrigin->toString());
+    } else
+        resourceRequest.clearHTTPReferrer();
+
     FrameLoadType loadType;
-    if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData)
+    if (resourceRequest.cachePolicy() == ReloadIgnoringCacheData)
         loadType = FrameLoadTypeReload;
     else if (lockBackForwardList || history()->currentItemShouldBeReplaced())
         loadType = FrameLoadTypeRedirectWithLockedBackForwardList;
     else
         loadType = FrameLoadTypeStandard;
 
-    if (request.resourceRequest().httpMethod() == "POST")
-        loadPostRequest(request.resourceRequest(), referrer, request.frameName(), loadType, event, formState.get());
-    else
-        loadURL(request.resourceRequest().url(), referrer, request.frameName(), loadType, event, formState.get());
+    if (loadType == FrameLoadTypeReload || loadType == FrameLoadTypeReloadFromOrigin)
+        resourceRequest.setCachePolicy(ReloadIgnoringCacheData);
+
+    loadURL(resourceRequest, request.frameName(), loadType, event, formState.get());
 
     // FIXME: It's possible this targetFrame will not be the same frame that was targeted by the actual
     // load if frame names have changed.
@@ -1061,28 +1053,20 @@
     }
 }
 
-void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const String& frameName, FrameLoadType newLoadType,
-    PassRefPtr<Event> event, PassRefPtr<FormState> prpFormState)
+void FrameLoader::loadURL(const ResourceRequest& request, const String& frameName, FrameLoadType newLoadType,
+    PassRefPtr<Event> event, PassRefPtr<FormState> formState)
 {
     if (m_inStopAllLoaders)
         return;
 
-    RefPtr<FormState> formState = prpFormState;
     bool isFormSubmission = formState;
-    
-    ResourceRequest request(newURL);
-    if (!referrer.isEmpty()) {
-        request.setHTTPReferrer(referrer);
-        RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString(referrer);
-        addHTTPOriginIfNeeded(request, referrerOrigin->toString());
-    }
 
     ASSERT(newLoadType != FrameLoadTypeSame);
 
     // The search for a target frame is done earlier in the case of form submission.
     Frame* targetFrame = isFormSubmission ? 0 : findFrameForNavigation(frameName);
     if (targetFrame && targetFrame != m_frame) {
-        targetFrame->loader()->loadURL(newURL, referrer, "_self", newLoadType, event, formState.release());
+        targetFrame->loader()->loadURL(request, "_self", newLoadType, event, formState);
         return;
     }
 
@@ -1092,16 +1076,16 @@
     NavigationAction action(request, newLoadType, isFormSubmission, event);
 
     if (!targetFrame && !frameName.isEmpty()) {
-        checkNewWindowPolicyAndContinue(formState.release(), frameName, action);
+        checkNewWindowPolicyAndContinue(formState, frameName, action);
         return;
     }
 
-    bool sameURL = shouldTreatURLAsSameAsCurrent(newURL);
-    loadWithNavigationAction(request, action, newLoadType, formState.release(), defaultSubstituteDataForURL(request.url()));
+    bool sameURL = shouldTreatURLAsSameAsCurrent(request.url());
+    loadWithNavigationAction(request, action, newLoadType, formState, defaultSubstituteDataForURL(request.url()));
     // Example of this case are sites that reload the same URL with a different cookie
     // driving the generated content, or a master frame with links that drive a target
     // frame, where the user has clicked on the same link repeatedly.
-    if (sameURL && newLoadType != FrameLoadTypeReload && newLoadType != FrameLoadTypeReloadFromOrigin)
+    if (sameURL && newLoadType != FrameLoadTypeReload && newLoadType != FrameLoadTypeReloadFromOrigin && request.httpMethod() != "POST")
         m_loadType = FrameLoadTypeSame;
 }
 
@@ -1137,35 +1121,22 @@
     const KURL& unreachableURL = request.substituteData().failingURL();
 
     FrameLoadType type;
-    if (shouldTreatURLAsSameAsCurrent(r.url()))
+    if (shouldTreatURLAsSameAsCurrent(r.url())) {
+        r.setCachePolicy(ReloadIgnoringCacheData);
         type = FrameLoadTypeSame;
-    else if (shouldTreatURLAsSameAsCurrent(unreachableURL) && m_loadType == FrameLoadTypeReload)
+    } else if (shouldTreatURLAsSameAsCurrent(unreachableURL) && m_loadType == FrameLoadTypeReload)
         type = FrameLoadTypeReload;
     else
         type = FrameLoadTypeStandard;
-    
-    // When we loading alternate content for an unreachable URL that we're
-    // visiting in the history list, we treat it as a reload so the history list 
-    // is appropriately maintained.
-    //
-    // FIXME: This seems like a dangerous overloading of the meaning of "FrameLoadTypeReload" ...
-    // shouldn't a more explicit type of reload be defined, that means roughly 
-    // "load without affecting history" ? 
-    if (shouldReloadToHandleUnreachableURL(unreachableURL)) {
-        // shouldReloadToHandleUnreachableURL() returns true only when the original load type is back-forward.
-        // In this case we should save the document state now. Otherwise the state can be lost because load type is
-        // changed and updateForBackForwardNavigation() will not be called when loading is committed.
-        history()->saveDocumentAndScrollState();
-
-        ASSERT(type == FrameLoadTypeStandard);
-        type = FrameLoadTypeReload;
-    }
-
     loadWithNavigationAction(r, NavigationAction(r, type, false), type, 0, request.substituteData());
 }
 
 void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState, const SubstituteData& substituteData, const String& overrideEncoding)
 {
+    ASSERT(m_client->hasWebView());
+    if (m_pageDismissalEventBeingDispatched != NoDismissal)
+        return;
+
     RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, substituteData);
     loader->setTriggeringAction(action);
 
@@ -1179,22 +1150,6 @@
     if (type == FrameLoadTypeRedirectWithLockedBackForwardList)
         loader->setIsClientRedirect(true);
 
-    // Retain because dispatchBeforeLoadEvent may release the last reference to it.
-    RefPtr<Frame> protect(m_frame);
-
-    ASSERT(m_client->hasWebView());
-
-    // Unfortunately the view must be non-nil, this is ultimately due
-    // to parser requiring a FrameView.  We should fix this dependency.
-
-    ASSERT(m_frame->view());
-
-    if (m_pageDismissalEventBeingDispatched != NoDismissal)
-        return;
-
-    if (m_frame->document())
-        m_previousURL = m_frame->document()->url();
-
     m_loadType = type;
     bool isFormSubmission = formState;
 
@@ -1215,11 +1170,6 @@
     frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Not allowed to load local resource: " + url);
 }
 
-const ResourceRequest& FrameLoader::initialRequest() const
-{
-    return activeDocumentLoader()->originalRequest();
-}
-
 bool FrameLoader::willLoadMediaElementURL(KURL& url)
 {
     ResourceRequest request(url);
@@ -1234,23 +1184,6 @@
     return error.isNull();
 }
 
-bool FrameLoader::shouldReloadToHandleUnreachableURL(const KURL& unreachableURL)
-{
-    if (unreachableURL.isEmpty())
-        return false;
-
-    if (!m_delegateIsHandlingProvisionalLoadError)
-        return false;
-
-    if (!isBackForwardLoadType(m_loadType))
-        return false;
-
-    // We only treat unreachableURLs specially during the delegate callbacks
-    // for provisional load errors. Loading alternate content
-    // at other times behaves like a standard load.
-    return unreachableURL == m_provisionalDocumentLoader->request().url();
-}
-
 void FrameLoader::reload(bool endToEndReload, const KURL& overrideURL, const String& overrideEncoding)
 {
     if (!m_documentLoader)
@@ -1263,8 +1196,16 @@
     else if (!m_documentLoader->unreachableURL().isEmpty())
         request.setURL(m_documentLoader->unreachableURL());
 
+    bool isFormSubmission = request.httpMethod() == "POST";
+    if (overrideEncoding.isEmpty())
+        request.setCachePolicy(ReloadIgnoringCacheData);
+    else if (isFormSubmission)
+        request.setCachePolicy(ReturnCacheDataDontLoad);
+    else
+        request.setCachePolicy(ReturnCacheDataElseLoad);
+
     FrameLoadType type = endToEndReload ? FrameLoadTypeReloadFromOrigin : FrameLoadTypeReload;
-    NavigationAction action(request, type, request.httpMethod() == "POST");
+    NavigationAction action(request, type, isFormSubmission);
     loadWithNavigationAction(request, action, type, 0, defaultSubstituteDataForURL(request.url()), overrideEncoding);
 }
 
@@ -1431,14 +1372,14 @@
     if (m_loadType != FrameLoadTypeReplace)
         closeOldDataSources();
 
-    transitionToCommitted();
-
-    if (pdl && m_documentLoader) {
-        // Check if the destination page is allowed to access the previous page's timing information.
+    // Check if the destination page is allowed to access the previous page's timing information.
+    if (m_frame->document()) {
         RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->request().url());
-        m_documentLoader->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_previousURL));
+        pdl->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_frame->document()->url()));
     }
 
+    transitionToCommitted();
+
     // Call clientRedirectCancelledOrFinished() here so that the frame load delegate is notified that the redirect's
     // status has changed, if there was a redirect.
     if (pdl->isClientRedirect())
@@ -1491,6 +1432,9 @@
 
     history()->updateForCommit();
     m_client->transitionToCommittedForNewPage();
+
+    if (!m_stateMachine.creatingInitialEmptyDocument() && !m_stateMachine.committedFirstRealDocumentLoad())
+        m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
 }
 
 void FrameLoader::clientRedirectCancelledOrFinished()
@@ -1906,6 +1850,30 @@
 
     applyUserAgent(request);
 
+    if (!isMainResource) {
+        if (request.isConditional())
+            request.setCachePolicy(ReloadIgnoringCacheData);
+        else if (documentLoader()->isLoadingInAPISense()) {
+            // If we inherit cache policy from a main resource, we use the DocumentLoader's
+            // original request cache policy for two reasons:
+            // 1. For POST requests, we mutate the cache policy for the main resource,
+            //    but we do not want this to apply to subresources
+            // 2. Delegates that modify the cache policy using willSendRequest: should
+            //    not affect any other resources. Such changes need to be done
+            //    per request.
+            ResourceRequestCachePolicy mainDocumentOriginalCachePolicy = documentLoader()->originalRequest().cachePolicy();
+            // Back-forward navigations try to load main resource from cache only to avoid re-submitting form data, and start over (with a warning dialog) if that fails.
+            // This policy is set on initial request too, but should not be inherited.
+            ResourceRequestCachePolicy subresourceCachePolicy = (mainDocumentOriginalCachePolicy == ReturnCacheDataDontLoad) ? ReturnCacheDataElseLoad : mainDocumentOriginalCachePolicy;
+            request.setCachePolicy(subresourceCachePolicy);
+        } else
+            request.setCachePolicy(UseProtocolCachePolicy);
+
+    // FIXME: Other FrameLoader functions have duplicated code for setting cache policy of main request when reloading.
+    // It seems better to manage it explicitly than to hide the logic inside addExtraFieldsToRequest().
+    } else if (m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadFromOrigin || request.isConditional())
+        request.setCachePolicy(ReloadIgnoringCacheData);
+
     if (request.cachePolicy() == ReloadIgnoringCacheData) {
         if (m_loadType == FrameLoadTypeReload)
             request.setHTTPHeaderField("Cache-Control", "max-age=0");
@@ -1949,40 +1917,6 @@
     request.setHTTPOrigin(origin);
 }
 
-void FrameLoader::loadPostRequest(const ResourceRequest& inRequest, const String& referrer, const String& frameName, FrameLoadType loadType, PassRefPtr<Event> event, PassRefPtr<FormState> prpFormState)
-{
-    RefPtr<FormState> formState = prpFormState;
-
-    // Previously when this method was reached, the original FrameLoadRequest had been deconstructed to build a 
-    // bunch of parameters that would come in here and then be built back up to a ResourceRequest.  In case
-    // any caller depends on the immutability of the original ResourceRequest, I'm rebuilding a ResourceRequest
-    // from scratch as it did all along.
-    const KURL& url = inRequest.url();
-    RefPtr<FormData> formData = inRequest.httpBody();
-    const String& contentType = inRequest.httpContentType();
-    String origin = inRequest.httpOrigin();
-
-    ResourceRequest workingResourceRequest(url);    
-
-    if (!referrer.isEmpty())
-        workingResourceRequest.setHTTPReferrer(referrer);
-    workingResourceRequest.setHTTPOrigin(origin);
-    workingResourceRequest.setHTTPMethod("POST");
-    workingResourceRequest.setHTTPBody(formData);
-    workingResourceRequest.setHTTPContentType(contentType);
-
-    NavigationAction action(workingResourceRequest, loadType, true, event);
-
-    if (!frameName.isEmpty()) {
-        // The search for a target frame is done earlier in the case of form submission.
-        if (Frame* targetFrame = formState ? 0 : findFrameForNavigation(frameName))
-            targetFrame->loader()->loadWithNavigationAction(workingResourceRequest, action, loadType, formState.release(), defaultSubstituteDataForURL(workingResourceRequest.url()));
-        else
-            checkNewWindowPolicyAndContinue(formState.release(), frameName, action);
-    } else
-        loadWithNavigationAction(workingResourceRequest, action, loadType, formState.release(), defaultSubstituteDataForURL(workingResourceRequest.url()));
-}
-
 unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
 {
     ASSERT(m_frame->document());
@@ -2458,13 +2392,17 @@
     RefPtr<FormData> formData = item->formData();
     ResourceRequest request(item->url());
     request.setHTTPReferrer(item->referrer());
+
+    NavigationAction action;
     if (formData) {
         request.setHTTPMethod("POST");
         request.setHTTPBody(formData);
         request.setHTTPContentType(item->formContentType());
         RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString(item->referrer());
         addHTTPOriginIfNeeded(request, securityOrigin->toString());
-    }
+        request.setCachePolicy(ReturnCacheDataDontLoad);
+    } else
+        request.setCachePolicy(ReturnCacheDataElseLoad);
 
     loadWithNavigationAction(request, NavigationAction(request, FrameLoadTypeBackForward, false), FrameLoadTypeBackForward, 0, defaultSubstituteDataForURL(request.url()));
 }
@@ -2613,7 +2551,6 @@
     info.addMember(m_openedFrames, "openedFrames");
     info.addMember(m_outgoingReferrer, "outgoingReferrer");
     info.addMember(m_networkingContext, "networkingContext");
-    info.addMember(m_previousURL, "previousURL");
     info.addMember(m_requestedHistoryItem, "requestedHistoryItem");
 }
 
diff --git a/Source/core/loader/FrameLoader.h b/Source/core/loader/FrameLoader.h
index c291d54..c8942d5 100644
--- a/Source/core/loader/FrameLoader.h
+++ b/Source/core/loader/FrameLoader.h
@@ -95,7 +95,7 @@
     void setupForReplace();
 
     // FIXME: These are all functions which start loads. We have too many.
-    void loadURLIntoChildFrame(const KURL&, const String& referer, Frame*);
+    void loadURLIntoChildFrame(const ResourceRequest&, Frame*);
     void loadFrameRequest(const FrameLoadRequest&, bool lockBackForwardList,  // Called by submitForm, calls loadPostRequest and loadURL.
         PassRefPtr<Event>, PassRefPtr<FormState>, ShouldSendReferrer);
 
@@ -144,7 +144,6 @@
     FrameState state() const { return m_state; }
 
     const ResourceRequest& originalRequest() const;
-    const ResourceRequest& initialRequest() const;
     void receivedMainResourceError(const ResourceError&);
 
     bool willLoadMediaElementURL(KURL&);
@@ -246,8 +245,6 @@
 
     bool suppressOpenerInNewFrame() const { return m_suppressOpenerInNewFrame; }
 
-    static ObjectContentType defaultObjectContentType(const KURL&, const String& mimeType, bool shouldPreferPlugInsForImages);
-
     bool shouldClose();
     
     void started();
@@ -262,8 +259,6 @@
 
     NetworkingContext* networkingContext() const;
 
-    const KURL& previousURL() const { return m_previousURL; }
-
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
 private:
@@ -302,8 +297,6 @@
 
     void closeOldDataSources();
 
-    bool shouldReloadToHandleUnreachableURL(const KURL&);
-
     void dispatchDidCommitLoad();
 
     void urlSelected(const FrameLoadRequest&, PassRefPtr<Event>, bool lockBackForwardList, ShouldSendReferrer);
@@ -312,10 +305,8 @@
     void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&,
         FrameLoadType, PassRefPtr<FormState>, const SubstituteData&, const String& overrideEncoding = String());
 
-    void loadPostRequest(const ResourceRequest&, const String& referrer,                // Called by loadFrameRequest, calls loadWithNavigationAction
-        const String& frameName, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);
-    void loadURL(const KURL&, const String& referrer, const String& frameName,          // Called by loadFrameRequest, calls loadWithNavigationAction or dispatches to navigation policy delegate
-        FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);
+    // Called by loadFrameRequest, calls loadWithNavigationAction or checkNewWindowPolicyAndContinue
+    void loadURL(const ResourceRequest&, const String& frameName, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);
 
     bool shouldReload(const KURL& currentURL, const KURL& destinationURL);
 
@@ -393,7 +384,6 @@
 
     RefPtr<FrameNetworkingContext> m_networkingContext;
 
-    KURL m_previousURL;
     RefPtr<HistoryItem> m_requestedHistoryItem;
 };
 
diff --git a/Source/core/loader/FrameLoaderStateMachine.cpp b/Source/core/loader/FrameLoaderStateMachine.cpp
index ec335fd..c5a9efb 100644
--- a/Source/core/loader/FrameLoaderStateMachine.cpp
+++ b/Source/core/loader/FrameLoaderStateMachine.cpp
@@ -46,7 +46,7 @@
 
 bool FrameLoaderStateMachine::committedFirstRealDocumentLoad() const 
 {
-    return m_state >= CommittedFirstRealLoad;
+    return m_state >= DisplayingInitialEmptyDocumentPostCommit;
 }
 
 bool FrameLoaderStateMachine::creatingInitialEmptyDocument() const 
@@ -56,7 +56,7 @@
 
 bool FrameLoaderStateMachine::isDisplayingInitialEmptyDocument() const 
 {
-    return m_state == DisplayingInitialEmptyDocument;
+    return m_state == DisplayingInitialEmptyDocument || m_state == DisplayingInitialEmptyDocumentPostCommit;
 }
 
 void FrameLoaderStateMachine::advanceTo(State state)
diff --git a/Source/core/loader/FrameLoaderStateMachine.h b/Source/core/loader/FrameLoaderStateMachine.h
index 23d6d85..1402ebc 100644
--- a/Source/core/loader/FrameLoaderStateMachine.h
+++ b/Source/core/loader/FrameLoaderStateMachine.h
@@ -46,6 +46,7 @@
     enum State {
         CreatingInitialEmptyDocument,
         DisplayingInitialEmptyDocument,
+        DisplayingInitialEmptyDocumentPostCommit,
         CommittedFirstRealLoad
     };
 
diff --git a/Source/core/loader/FrameNetworkingContext.h b/Source/core/loader/FrameNetworkingContext.h
index 274ee68..2cc05f7 100644
--- a/Source/core/loader/FrameNetworkingContext.h
+++ b/Source/core/loader/FrameNetworkingContext.h
@@ -22,7 +22,7 @@
 
 #include "core/dom/Document.h"
 #include "core/page/Frame.h"
-#include "origin/ReferrerPolicy.h"
+#include "weborigin/ReferrerPolicy.h"
 #include "core/platform/network/NetworkingContext.h"
 
 namespace WebCore {
diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp
index bceddd1..db60677 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -38,7 +38,7 @@
 #include "core/page/Frame.h"
 #include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderVideo.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #if ENABLE(SVG)
 #include "core/rendering/svg/RenderSVGImage.h"
@@ -211,8 +211,8 @@
             clearFailedLoadURL();
     } else if (!attr.isNull()) {
         // Fire an error event if the url is empty.
-        // FIXME: Should we fire this event asynchronoulsy via errorEventSender()?
-        m_element->dispatchEvent(Event::create(eventNames().errorEvent, false, false));
+        m_hasPendingErrorEvent = true;
+        errorEventSender().dispatchEventSoon(this);
     }
     
     CachedImage* oldImage = m_image.get();
diff --git a/Source/core/loader/LinkLoader.cpp b/Source/core/loader/LinkLoader.cpp
index f1734be..3c0ec73 100644
--- a/Source/core/loader/LinkLoader.cpp
+++ b/Source/core/loader/LinkLoader.cpp
@@ -109,16 +109,8 @@
     m_client->didSendDOMContentLoadedForLinkPrerender();
 }
 
-bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const String& type,
-                          const String& sizes, const KURL& href, Document* document)
+bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const String& type, const KURL& href, Document* document)
 {
-    // We'll record this URL per document, even if we later only use it in top level frames
-    if (relAttribute.iconType() != InvalidIcon && href.isValid() && !href.isEmpty()) {
-        if (!m_client->shouldLoadLink()) 
-            return false;
-        document->addIconURL(href.string(), type, sizes, relAttribute.iconType());
-    }
-
     if (relAttribute.isDNSPrefetch()) {
         Settings* settings = document->settings();
         // FIXME: The href attribute of the link element can be in "//hostname" form, and we shouldn't attempt
diff --git a/Source/core/loader/LinkLoader.h b/Source/core/loader/LinkLoader.h
index b558857..d49f2ee 100644
--- a/Source/core/loader/LinkLoader.h
+++ b/Source/core/loader/LinkLoader.h
@@ -62,7 +62,7 @@
     virtual void didSendDOMContentLoadedForPrerender() OVERRIDE;
 
     void released();
-    bool loadLink(const LinkRelAttribute&, const String& type, const String& sizes, const KURL&, Document*);
+    bool loadLink(const LinkRelAttribute&, const String& type, const KURL&, Document*);
 
 private:
     void linkLoadTimerFired(Timer<LinkLoader>*);
diff --git a/Source/core/loader/MixedContentChecker.cpp b/Source/core/loader/MixedContentChecker.cpp
index ddef5b2..4691de1 100644
--- a/Source/core/loader/MixedContentChecker.cpp
+++ b/Source/core/loader/MixedContentChecker.cpp
@@ -36,8 +36,8 @@
 #include "core/page/DOMWindow.h"
 #include "core/page/Frame.h"
 #include "core/page/Settings.h"
-#include "origin/SchemeRegistry.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SchemeRegistry.h"
+#include "weborigin/SecurityOrigin.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/loader/PingLoader.cpp b/Source/core/loader/PingLoader.cpp
index 2ef5451..518f9fb 100644
--- a/Source/core/loader/PingLoader.cpp
+++ b/Source/core/loader/PingLoader.cpp
@@ -46,8 +46,8 @@
 #include "core/platform/network/ResourceHandle.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
 
 namespace WebCore {
 
@@ -114,18 +114,18 @@
     String referrer = SecurityPolicy::generateReferrerHeader(frame->document()->referrerPolicy(), reportURL, frame->loader()->outgoingReferrer());
     if (!referrer.isEmpty())
         request.setHTTPReferrer(referrer);
-    OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request));
+    OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request, SecurityOrigin::create(reportURL)->isSameSchemeHostPort(frame->document()->securityOrigin()) ? AllowStoredCredentials : DoNotAllowStoredCredentials));
 
     // Leak the ping loader, since it will kill itself as soon as it receives a response.
     PingLoader* leakedPingLoader = pingLoader.leakPtr();
     UNUSED_PARAM(leakedPingLoader);
 }
 
-PingLoader::PingLoader(Frame* frame, ResourceRequest& request)
+PingLoader::PingLoader(Frame* frame, ResourceRequest& request, StoredCredentials credentialsAllowed)
     : m_timeout(this, &PingLoader::timeout)
 {
     unsigned long identifier = createUniqueIdentifier();
-    m_handle = ResourceHandle::create(frame->loader()->networkingContext(), request, this, false, false, AllowStoredCredentials);
+    m_handle = ResourceHandle::create(frame->loader()->networkingContext(), request, this, false, false, credentialsAllowed);
 
     InspectorInstrumentation::continueAfterPingLoader(frame, identifier, frame->loader()->activeDocumentLoader(), request, ResourceResponse());
 
diff --git a/Source/core/loader/PingLoader.h b/Source/core/loader/PingLoader.h
index a0f73db..d65842d 100644
--- a/Source/core/loader/PingLoader.h
+++ b/Source/core/loader/PingLoader.h
@@ -34,6 +34,7 @@
 
 #include "core/platform/Timer.h"
 #include "core/platform/network/ResourceHandleClient.h"
+#include "core/platform/network/ResourceHandleTypes.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/RefPtr.h>
 
@@ -61,7 +62,7 @@
     virtual ~PingLoader();
 
 private:
-    PingLoader(Frame*, ResourceRequest&);
+    PingLoader(Frame*, ResourceRequest&, StoredCredentials = AllowStoredCredentials);
 
     virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&) OVERRIDE { delete this; }
     virtual void didReceiveData(ResourceHandle*, const char*, int, int) OVERRIDE { delete this; }
diff --git a/Source/core/loader/Prerenderer.cpp b/Source/core/loader/Prerenderer.cpp
index 6f027b4..b3a5c4e 100644
--- a/Source/core/loader/Prerenderer.cpp
+++ b/Source/core/loader/Prerenderer.cpp
@@ -38,8 +38,8 @@
 #include "core/loader/PrerendererClient.h"
 #include "core/page/Frame.h"
 #include "core/platform/PrerenderHandle.h"
-#include "origin/ReferrerPolicy.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/ReferrerPolicy.h"
+#include "weborigin/SecurityPolicy.h"
 
 #include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/PassOwnPtr.h>
diff --git a/Source/core/loader/ResourceLoader.cpp b/Source/core/loader/ResourceLoader.cpp
index b97e3de..34bff2a 100644
--- a/Source/core/loader/ResourceLoader.cpp
+++ b/Source/core/loader/ResourceLoader.cpp
@@ -43,7 +43,7 @@
 #include "core/platform/Logging.h"
 #include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceHandle.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/ResourceLoaderOptions.h b/Source/core/loader/ResourceLoaderOptions.h
index ad1adaa..88c1fc0 100644
--- a/Source/core/loader/ResourceLoaderOptions.h
+++ b/Source/core/loader/ResourceLoaderOptions.h
@@ -61,12 +61,28 @@
 };
 
 struct ResourceLoaderOptions {
-    ResourceLoaderOptions() : sendLoadCallbacks(DoNotSendCallbacks), sniffContent(DoNotSniffContent), dataBufferingPolicy(BufferData), allowCredentials(DoNotAllowStoredCredentials), crossOriginCredentialPolicy(DoNotAskClientForCrossOriginCredentials), securityCheck(DoSecurityCheck) { }
-    ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacks, ContentSniffingPolicy sniffContent, DataBufferingPolicy dataBufferingPolicy, StoredCredentials allowCredentials, ClientCrossOriginCredentialPolicy crossOriginCredentialPolicy, SecurityCheckPolicy securityCheck)
+    ResourceLoaderOptions()
+        : sendLoadCallbacks(DoNotSendCallbacks)
+        , sniffContent(DoNotSniffContent)
+        , dataBufferingPolicy(BufferData)
+        , allowCredentials(DoNotAllowStoredCredentials)
+        , credentialsRequested(ClientDidNotRequestCredentials)
+        , crossOriginCredentialPolicy(DoNotAskClientForCrossOriginCredentials)
+        , securityCheck(DoSecurityCheck) { }
+
+    ResourceLoaderOptions(
+        SendCallbackPolicy sendLoadCallbacks,
+        ContentSniffingPolicy sniffContent,
+        DataBufferingPolicy dataBufferingPolicy,
+        StoredCredentials allowCredentials,
+        CredentialRequest credentialsRequested,
+        ClientCrossOriginCredentialPolicy crossOriginCredentialPolicy,
+        SecurityCheckPolicy securityCheck)
         : sendLoadCallbacks(sendLoadCallbacks)
         , sniffContent(sniffContent)
         , dataBufferingPolicy(dataBufferingPolicy)
         , allowCredentials(allowCredentials)
+        , credentialsRequested(credentialsRequested)
         , crossOriginCredentialPolicy(crossOriginCredentialPolicy)
         , securityCheck(securityCheck)
     {
@@ -75,6 +91,7 @@
     ContentSniffingPolicy sniffContent;
     DataBufferingPolicy dataBufferingPolicy;
     StoredCredentials allowCredentials; // Whether HTTP credentials and cookies are sent with the request.
+    CredentialRequest credentialsRequested; // Whether the client (e.g. XHR) wanted credentials in the first place.
     ClientCrossOriginCredentialPolicy crossOriginCredentialPolicy; // Whether we will ask the client for credentials (if we allow credentials at all).
     SecurityCheckPolicy securityCheck;
 };
diff --git a/Source/core/loader/SubframeLoader.cpp b/Source/core/loader/SubframeLoader.cpp
index 3bea110..c3b999f 100644
--- a/Source/core/loader/SubframeLoader.cpp
+++ b/Source/core/loader/SubframeLoader.cpp
@@ -52,8 +52,8 @@
 #include "core/plugins/PluginData.h"
 #include "core/rendering/RenderEmbeddedObject.h"
 #include "core/rendering/RenderView.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
 
 namespace WebCore {
     
diff --git a/Source/core/loader/TextTrackLoader.cpp b/Source/core/loader/TextTrackLoader.cpp
index 842c42c..1fa9ac4 100644
--- a/Source/core/loader/TextTrackLoader.cpp
+++ b/Source/core/loader/TextTrackLoader.cpp
@@ -37,7 +37,7 @@
 #include "core/platform/Logging.h"
 #include "core/platform/SharedBuffer.h"
 #include "core/platform/network/ResourceHandle.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
     
diff --git a/Source/core/loader/ThreadableLoader.h b/Source/core/loader/ThreadableLoader.h
index 89724fe..e12b540 100644
--- a/Source/core/loader/ThreadableLoader.h
+++ b/Source/core/loader/ThreadableLoader.h
@@ -32,7 +32,7 @@
 #define ThreadableLoader_h
 
 #include "core/loader/ResourceLoaderOptions.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include "core/platform/network/ResourceHandle.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/PassRefPtr.h>
@@ -59,12 +59,22 @@
         PreventPreflight
     };
 
+    enum ContentSecurityPolicyEnforcement {
+        EnforceConnectSrcDirective,
+        DoNotEnforceContentSecurityPolicy,
+    };
+
     struct ThreadableLoaderOptions : public ResourceLoaderOptions {
-        ThreadableLoaderOptions() : preflightPolicy(ConsiderPreflight), crossOriginRequestPolicy(DenyCrossOriginRequests) { }
+        ThreadableLoaderOptions()
+            : preflightPolicy(ConsiderPreflight)
+            , crossOriginRequestPolicy(DenyCrossOriginRequests)
+            , contentSecurityPolicyEnforcement(EnforceConnectSrcDirective) { }
+
         PreflightPolicy preflightPolicy; // If AccessControl is used, how to determine if a preflight is needed.
         CrossOriginRequestPolicy crossOriginRequestPolicy;
         RefPtr<SecurityOrigin> securityOrigin;
         AtomicString initiator;
+        ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement;
     };
 
     // Useful for doing loader operations from any thread (not threadsafe, 
diff --git a/Source/core/loader/archive/MHTMLArchive.cpp b/Source/core/loader/archive/MHTMLArchive.cpp
index 65281ac..a958caf 100644
--- a/Source/core/loader/archive/MHTMLArchive.cpp
+++ b/Source/core/loader/archive/MHTMLArchive.cpp
@@ -40,7 +40,7 @@
 #include "core/platform/MIMETypeRegistry.h"
 #include "core/platform/SharedBuffer.h"
 #include "core/platform/text/QuotedPrintable.h"
-#include "origin/SchemeRegistry.h"
+#include "weborigin/SchemeRegistry.h"
 #include "wtf/CryptographicallyRandomNumber.h"
 #include "wtf/DateMath.h"
 #include "wtf/GregorianDateTime.h"
diff --git a/Source/core/loader/cache/CachedResourceLoader.cpp b/Source/core/loader/cache/CachedResourceLoader.cpp
index 854aed9..ba2a389 100644
--- a/Source/core/loader/cache/CachedResourceLoader.cpp
+++ b/Source/core/loader/cache/CachedResourceLoader.cpp
@@ -58,8 +58,8 @@
 #include "core/page/Performance.h"
 #include "core/page/Settings.h"
 #include "core/platform/Logging.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
 
 #include "core/loader/cache/CachedTextTrack.h"
 
@@ -186,7 +186,7 @@
         memoryCache()->remove(existing);
     }
 
-    request.setOptions(ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck));
+    request.setOptions(ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck));
     return static_cast<CachedCSSStyleSheet*>(requestResource(CachedResource::CSSStyleSheet, request).get());
 }
 
@@ -233,6 +233,7 @@
     case CachedResource::SVGDocumentResource:
 #endif
     case CachedResource::CSSStyleSheet:
+    case CachedResource::RawResource:
         // These resource can inject script into the current document (Script,
         // XSL) or exfiltrate the content of the current document (CSS).
         if (Frame* f = frame())
@@ -241,7 +242,6 @@
         break;
     case CachedResource::TextTrackResource:
     case CachedResource::ShaderResource:
-    case CachedResource::RawResource:
     case CachedResource::ImageResource:
     case CachedResource::FontResource: {
         // These resources can corrupt only the frame's pixels.
@@ -498,34 +498,6 @@
     request.setTargetType(targetType);
 }
 
-ResourceRequestCachePolicy CachedResourceLoader::resourceRequestCachePolicy(const ResourceRequest& request, CachedResource::Type type)
-{
-    if (type == CachedResource::MainResource) {
-        FrameLoadType frameLoadType = frame()->loader()->loadType();
-        bool isReload = frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin;
-        if (request.httpMethod() == "POST" && (isReload || frameLoadType == FrameLoadTypeBackForward))
-            return ReturnCacheDataDontLoad;
-        if (!m_documentLoader->overrideEncoding().isEmpty() || frameLoadType == FrameLoadTypeBackForward)
-            return ReturnCacheDataElseLoad;
-        if (isReload || frameLoadType == FrameLoadTypeSame || request.isConditional())
-            return ReloadIgnoringCacheData;
-        return UseProtocolCachePolicy;
-    }
-
-    if (request.isConditional())
-        return ReloadIgnoringCacheData;
-
-    if (m_documentLoader->isLoadingInAPISense()) {
-        // For POST requests, we mutate the main resource's cache policy to avoid form resubmission.
-        // This policy should not be inherited by subresources.
-        ResourceRequestCachePolicy mainResourceCachePolicy = m_documentLoader->request().cachePolicy();
-        if (mainResourceCachePolicy == ReturnCacheDataDontLoad)
-            return ReturnCacheDataElseLoad;
-        return mainResourceCachePolicy;
-    }
-    return UseProtocolCachePolicy;
-}
-
 void CachedResourceLoader::addAdditionalRequestHeaders(ResourceRequest& request, CachedResource::Type type)
 {
     if (!frame())
@@ -555,7 +527,6 @@
         FrameLoader::addHTTPOriginIfNeeded(request, outgoingOrigin);
     }
 
-    request.setCachePolicy(resourceRequestCachePolicy(request, type));
     if (request.targetType() == ResourceRequest::TargetIsUnspecified)
         determineTargetType(request, type);
     frameLoader->addExtraFieldsToRequest(request);
@@ -1042,7 +1013,7 @@
 
 const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions()
 {
-    static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForCrossOriginCredentials, DoSecurityCheck);
+    static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, DoSecurityCheck);
     return options;
 }
 
diff --git a/Source/core/loader/cache/CachedResourceLoader.h b/Source/core/loader/cache/CachedResourceLoader.h
index 8550160..728836e 100644
--- a/Source/core/loader/cache/CachedResourceLoader.h
+++ b/Source/core/loader/cache/CachedResourceLoader.h
@@ -144,7 +144,6 @@
     RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, ResourceRequest&, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption) const;
 
     void determineTargetType(ResourceRequest&, CachedResource::Type);
-    ResourceRequestCachePolicy resourceRequestCachePolicy(const ResourceRequest&, CachedResource::Type);
     void addAdditionalRequestHeaders(ResourceRequest&, CachedResource::Type);
 
     void notifyLoadedFromMemoryCache(CachedResource*);
diff --git a/Source/core/loader/cache/MemoryCache.cpp b/Source/core/loader/cache/MemoryCache.cpp
index 7feb100..d118fcb 100644
--- a/Source/core/loader/cache/MemoryCache.cpp
+++ b/Source/core/loader/cache/MemoryCache.cpp
@@ -45,8 +45,8 @@
 #include "core/workers/WorkerContext.h"
 #include "core/workers/WorkerLoaderProxy.h"
 #include "core/workers/WorkerThread.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityOriginHash.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityOriginHash.h"
 
 using namespace std;
 
diff --git a/Source/core/loader/cache/MemoryCache.h b/Source/core/loader/cache/MemoryCache.h
index 51fdb87..7742c47 100644
--- a/Source/core/loader/cache/MemoryCache.h
+++ b/Source/core/loader/cache/MemoryCache.h
@@ -26,7 +26,7 @@
 #define Cache_h
 
 #include "core/loader/cache/CachedResource.h"
-#include "origin/SecurityOriginHash.h"
+#include "weborigin/SecurityOriginHash.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
diff --git a/Source/core/page/BarInfo.cpp b/Source/core/page/BarProp.cpp
similarity index 93%
rename from Source/core/page/BarInfo.cpp
rename to Source/core/page/BarProp.cpp
index 0679641..aeb9e6f 100644
--- a/Source/core/page/BarInfo.cpp
+++ b/Source/core/page/BarProp.cpp
@@ -6,13 +6,13 @@
  * are met:
  *
  * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
+ *     notice, this list of conditions and the following disclaimer.
  * 2.  Redistributions in binary form must reproduce the above copyright
  *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
+ *     documentation and/or other materials provided with the distribution.
  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
+ *     from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -27,7 +27,7 @@
  */
 
 #include "config.h"
-#include "core/page/BarInfo.h"
+#include "core/page/BarProp.h"
 
 #include "core/page/Chrome.h"
 #include "core/page/Frame.h"
@@ -35,19 +35,19 @@
 
 namespace WebCore {
 
-BarInfo::BarInfo(Frame* frame, Type type)
+BarProp::BarProp(Frame* frame, Type type)
     : DOMWindowProperty(frame)
     , m_type(type)
 {
     ScriptWrappable::init(this);
 }
 
-BarInfo::Type BarInfo::type() const
+BarProp::Type BarProp::type() const
 {
     return m_type;
 }
 
-bool BarInfo::visible() const
+bool BarProp::visible() const
 {
     if (!m_frame)
         return false;
diff --git a/Source/core/page/BarInfo.h b/Source/core/page/BarProp.h
similarity index 83%
rename from Source/core/page/BarInfo.h
rename to Source/core/page/BarProp.h
index 4bc33c9..9c6b724 100644
--- a/Source/core/page/BarInfo.h
+++ b/Source/core/page/BarProp.h
@@ -6,13 +6,13 @@
  * are met:
  *
  * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
+ *     notice, this list of conditions and the following disclaimer.
  * 2.  Redistributions in binary form must reproduce the above copyright
  *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
+ *     documentation and/or other materials provided with the distribution.
  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
+ *     from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -26,32 +26,32 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef BarInfo_h
-#define BarInfo_h
+#ifndef BarProp_h
+#define BarProp_h
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/page/DOMWindowProperty.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
     class Frame;
 
-    class BarInfo : public ScriptWrappable, public RefCounted<BarInfo>, public DOMWindowProperty {
+    class BarProp : public ScriptWrappable, public RefCounted<BarProp>, public DOMWindowProperty {
     public:
         enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar };
 
-        static PassRefPtr<BarInfo> create(Frame* frame, Type type) { return adoptRef(new BarInfo(frame, type)); }
+        static PassRefPtr<BarProp> create(Frame* frame, Type type) { return adoptRef(new BarProp(frame, type)); }
 
         Type type() const;
         bool visible() const;
 
     private:
-        BarInfo(Frame*, Type);
+        BarProp(Frame*, Type);
         Type m_type;
     };
 
 } // namespace WebCore
 
-#endif // BarInfo_h
+#endif // BarProp_h
diff --git a/Source/core/page/BarInfo.idl b/Source/core/page/BarProp.idl
similarity index 96%
rename from Source/core/page/BarInfo.idl
rename to Source/core/page/BarProp.idl
index 685e21b..8f91d38 100644
--- a/Source/core/page/BarInfo.idl
+++ b/Source/core/page/BarProp.idl
@@ -26,9 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    NoInterfaceObject,
-] interface BarInfo {
+interface BarProp {
     readonly attribute boolean visible;
 };
 
diff --git a/Source/core/page/Chrome.cpp b/Source/core/page/Chrome.cpp
index b98556b..8126113 100644
--- a/Source/core/page/Chrome.cpp
+++ b/Source/core/page/Chrome.cpp
@@ -52,7 +52,7 @@
 #include "core/rendering/RenderObject.h"
 #include "core/storage/StorageNamespace.h"
 #include "modules/geolocation/Geolocation.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #if ENABLE(INPUT_TYPE_COLOR)
 #include "core/platform/ColorChooser.h"
@@ -121,11 +121,6 @@
     m_client->layoutUpdated(frame);
 }
 
-void Chrome::scrollbarsModeDidChange() const
-{
-    m_client->scrollbarsModeDidChange();
-}
-
 void Chrome::setWindowRect(const FloatRect& rect) const
 {
     m_client->setWindowRect(rect);
diff --git a/Source/core/page/Chrome.h b/Source/core/page/Chrome.h
index 76a2e63..2cb13df 100644
--- a/Source/core/page/Chrome.h
+++ b/Source/core/page/Chrome.h
@@ -70,7 +70,6 @@
     virtual IntPoint screenToRootView(const IntPoint&) const OVERRIDE;
     virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE;
     virtual WebKit::WebScreenInfo screenInfo() const OVERRIDE;
-    virtual void scrollbarsModeDidChange() const OVERRIDE;
     virtual void setCursor(const Cursor&) OVERRIDE;
     virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE;
 
diff --git a/Source/core/page/ChromeClient.h b/Source/core/page/ChromeClient.h
index da3d9ca..f56e1f5 100644
--- a/Source/core/page/ChromeClient.h
+++ b/Source/core/page/ChromeClient.h
@@ -154,7 +154,6 @@
     virtual IntPoint screenToRootView(const IntPoint&) const = 0;
     virtual IntRect rootViewToScreen(const IntRect&) const = 0;
     virtual WebKit::WebScreenInfo screenInfo() const = 0;
-    virtual void scrollbarsModeDidChange() const = 0;
     virtual void setCursor(const Cursor&) = 0;
     virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
 #if !USE(REQUEST_ANIMATION_FRAME_TIMER)
diff --git a/Source/core/page/ContentSecurityPolicy.cpp b/Source/core/page/ContentSecurityPolicy.cpp
index c0daeb2..650b43b 100644
--- a/Source/core/page/ContentSecurityPolicy.cpp
+++ b/Source/core/page/ContentSecurityPolicy.cpp
@@ -28,6 +28,7 @@
 
 #include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/ScriptCallStackFactory.h"
+#include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptState.h"
 #include "core/dom/DOMStringList.h"
 #include "core/dom/Document.h"
@@ -43,8 +44,9 @@
 #include "core/page/UseCounter.h"
 #include "core/platform/KURL.h"
 #include "core/platform/network/FormData.h"
-#include "origin/SchemeRegistry.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/KnownPorts.h"
+#include "weborigin/SchemeRegistry.h"
+#include "weborigin/SecurityOrigin.h"
 #include "wtf/HashSet.h"
 #include "wtf/text/TextEncoding.h"
 #include "wtf/text/TextPosition.h"
@@ -1881,4 +1883,14 @@
     return RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnabled();
 }
 
+bool ContentSecurityPolicy::shouldBypassMainWorld(ScriptExecutionContext* context)
+{
+    if (context && context->isDocument()) {
+        Document* document = toDocument(context);
+        if (document->frame())
+            return document->frame()->script()->shouldBypassMainWorldContentSecurityPolicy();
+    }
+    return false;
+}
+
 }
diff --git a/Source/core/page/ContentSecurityPolicy.h b/Source/core/page/ContentSecurityPolicy.h
index aa76d5e..13b23ea 100644
--- a/Source/core/page/ContentSecurityPolicy.h
+++ b/Source/core/page/ContentSecurityPolicy.h
@@ -136,6 +136,8 @@
 
     bool experimentalFeaturesEnabled() const;
 
+    static bool shouldBypassMainWorld(ScriptExecutionContext*);
+
 private:
     explicit ContentSecurityPolicy(ScriptExecutionContext*);
 
diff --git a/Source/core/page/ContextMenuController.cpp b/Source/core/page/ContextMenuController.cpp
index 39fb44e..70834f7 100644
--- a/Source/core/page/ContextMenuController.cpp
+++ b/Source/core/page/ContextMenuController.cpp
@@ -347,8 +347,6 @@
         if (Page* page = frame->page())
             page->inspectorController()->inspect(m_hitTestResult.innerNonSharedNode());
         break;
-    case ContextMenuItemTagDictationAlternative:
-        break;
     default:
         break;
     }
@@ -852,7 +850,6 @@
         case ContextMenuItemCustomTagNoAction:
         case ContextMenuItemLastCustomTag:
         case ContextMenuItemBaseApplicationTag:
-        case ContextMenuItemTagDictationAlternative:
             break;
         case ContextMenuItemTagMediaPlayPause:
             if (m_hitTestResult.mediaPlaying())
diff --git a/Source/core/page/DOMSecurityPolicy.cpp b/Source/core/page/DOMSecurityPolicy.cpp
index 97f91bc..ca12bd3 100644
--- a/Source/core/page/DOMSecurityPolicy.cpp
+++ b/Source/core/page/DOMSecurityPolicy.cpp
@@ -84,6 +84,7 @@
 DOMSecurityPolicy::DOMSecurityPolicy(ScriptExecutionContext* context)
     : ContextDestructionObserver(context)
 {
+    ScriptWrappable::init(this);
 }
 
 DOMSecurityPolicy::~DOMSecurityPolicy()
diff --git a/Source/core/page/DOMSecurityPolicy.h b/Source/core/page/DOMSecurityPolicy.h
index 48bb556..3cbe0da 100644
--- a/Source/core/page/DOMSecurityPolicy.h
+++ b/Source/core/page/DOMSecurityPolicy.h
@@ -26,6 +26,7 @@
 #ifndef DOMSecurityPolicy_h
 #define DOMSecurityPolicy_h
 
+#include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/ContextDestructionObserver.h"
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
@@ -38,7 +39,7 @@
 class DOMStringList;
 class Frame;
 
-class DOMSecurityPolicy : public RefCounted<DOMSecurityPolicy>, public ContextDestructionObserver {
+class DOMSecurityPolicy : public RefCounted<DOMSecurityPolicy>, public ScriptWrappable, public ContextDestructionObserver {
 public:
     static PassRefPtr<DOMSecurityPolicy> create(ScriptExecutionContext* context)
     {
diff --git a/Source/core/page/DOMSelection.cpp b/Source/core/page/DOMSelection.cpp
index 9f71e6c..ed91368 100644
--- a/Source/core/page/DOMSelection.cpp
+++ b/Source/core/page/DOMSelection.cpp
@@ -60,6 +60,7 @@
     : DOMWindowProperty(treeScope->rootNode()->document()->frame())
     , m_treeScope(treeScope)
 {
+    ScriptWrappable::init(this);
 }
 
 void DOMSelection::clearTreeScope()
diff --git a/Source/core/page/DOMSelection.h b/Source/core/page/DOMSelection.h
index c2b1314..90163b7 100644
--- a/Source/core/page/DOMSelection.h
+++ b/Source/core/page/DOMSelection.h
@@ -31,6 +31,7 @@
 #ifndef DOMSelection_h
 #define DOMSelection_h
 
+#include "bindings/v8/ScriptWrappable.h"
 #include "core/page/DOMWindowProperty.h"
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
@@ -38,73 +39,73 @@
 
 namespace WebCore {
 
-    class Frame;
-    class Node;
-    class Position;
-    class Range;
-    class TreeScope;
-    class VisibleSelection;
+class Frame;
+class Node;
+class Position;
+class Range;
+class TreeScope;
+class VisibleSelection;
 
-    typedef int ExceptionCode;
+typedef int ExceptionCode;
 
-    class DOMSelection : public RefCounted<DOMSelection>, public DOMWindowProperty {
-    public:
-        static PassRefPtr<DOMSelection> create(const TreeScope* treeScope) { return adoptRef(new DOMSelection(treeScope)); }
+class DOMSelection : public RefCounted<DOMSelection>, public ScriptWrappable, public DOMWindowProperty {
+public:
+    static PassRefPtr<DOMSelection> create(const TreeScope* treeScope) { return adoptRef(new DOMSelection(treeScope)); }
 
-        void clearTreeScope();
+    void clearTreeScope();
 
-        // Safari Selection Object API
-        // These methods return the valid equivalents of internal editing positions.
-        Node* baseNode() const;
-        Node* extentNode() const;
-        int baseOffset() const;
-        int extentOffset() const;
-        String type() const;
-        void setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int extentOffset, ExceptionCode&);
-        void setPosition(Node*, int offset, ExceptionCode&);
-        void modify(const String& alter, const String& direction, const String& granularity);
+    // Safari Selection Object API
+    // These methods return the valid equivalents of internal editing positions.
+    Node* baseNode() const;
+    Node* extentNode() const;
+    int baseOffset() const;
+    int extentOffset() const;
+    String type() const;
+    void setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int extentOffset, ExceptionCode&);
+    void setPosition(Node*, int offset, ExceptionCode&);
+    void modify(const String& alter, const String& direction, const String& granularity);
 
-        // Mozilla Selection Object API
-        // In Firefox, anchor/focus are the equal to the start/end of the selection,
-        // but reflect the direction in which the selection was made by the user.  That does
-        // not mean that they are base/extent, since the base/extent don't reflect
-        // expansion.
-        // These methods return the valid equivalents of internal editing positions.
-        Node* anchorNode() const;
-        int anchorOffset() const;
-        Node* focusNode() const;
-        int focusOffset() const;
-        bool isCollapsed() const;
-        int rangeCount() const;
-        void collapse(Node*, int offset, ExceptionCode&);
-        void collapseToEnd(ExceptionCode&);
-        void collapseToStart(ExceptionCode&);
-        void extend(Node*, int offset, ExceptionCode&);
-        PassRefPtr<Range> getRangeAt(int, ExceptionCode&);
-        void removeAllRanges();
-        void addRange(Range*);
-        void deleteFromDocument();
-        bool containsNode(const Node*, bool partlyContained) const;
-        void selectAllChildren(Node*, ExceptionCode&);
+    // Mozilla Selection Object API
+    // In Firefox, anchor/focus are the equal to the start/end of the selection,
+    // but reflect the direction in which the selection was made by the user. That does
+    // not mean that they are base/extent, since the base/extent don't reflect
+    // expansion.
+    // These methods return the valid equivalents of internal editing positions.
+    Node* anchorNode() const;
+    int anchorOffset() const;
+    Node* focusNode() const;
+    int focusOffset() const;
+    bool isCollapsed() const;
+    int rangeCount() const;
+    void collapse(Node*, int offset, ExceptionCode&);
+    void collapseToEnd(ExceptionCode&);
+    void collapseToStart(ExceptionCode&);
+    void extend(Node*, int offset, ExceptionCode&);
+    PassRefPtr<Range> getRangeAt(int, ExceptionCode&);
+    void removeAllRanges();
+    void addRange(Range*);
+    void deleteFromDocument();
+    bool containsNode(const Node*, bool partlyContained) const;
+    void selectAllChildren(Node*, ExceptionCode&);
 
-        String toString();
+    String toString();
 
-        // Microsoft Selection Object API
-        void empty();
+    // Microsoft Selection Object API
+    void empty();
 
-    private:
-        const TreeScope* m_treeScope;
+private:
+    const TreeScope* m_treeScope;
 
-        explicit DOMSelection(const TreeScope*);
+    explicit DOMSelection(const TreeScope*);
 
-        // Convenience method for accessors, does not NULL check m_frame.
-        const VisibleSelection& visibleSelection() const;
+    // Convenience method for accessors, does not check m_frame present.
+    const VisibleSelection& visibleSelection() const;
 
-        Node* shadowAdjustedNode(const Position&) const;
-        int shadowAdjustedOffset(const Position&) const;
+    Node* shadowAdjustedNode(const Position&) const;
+    int shadowAdjustedOffset(const Position&) const;
 
-        bool isValidForPosition(Node*) const;
-    };
+    bool isValidForPosition(Node*) const;
+};
 
 } // namespace WebCore
 
diff --git a/Source/core/page/DOMWindow.cpp b/Source/core/page/DOMWindow.cpp
index 71e4b54..ff19489 100644
--- a/Source/core/page/DOMWindow.cpp
+++ b/Source/core/page/DOMWindow.cpp
@@ -71,7 +71,7 @@
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/loader/appcache/DOMApplicationCache.h"
-#include "core/page/BarInfo.h"
+#include "core/page/BarProp.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
 #include "core/page/Console.h"
@@ -104,8 +104,8 @@
 #include "core/storage/StorageNamespace.h"
 #include "modules/device_orientation/DeviceMotionController.h"
 #include "modules/notifications/DOMWindowNotifications.h"
-#include "origin/SecurityOrigin.h"
-#include "origin/SecurityPolicy.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
 
 using std::min;
 using std::max;
@@ -398,6 +398,7 @@
 {
     ASSERT(frame());
     ASSERT(DOMWindow::document());
+    ScriptWrappable::init(this);
 }
 
 void DOMWindow::didSecureTransitionTo(Document* document)
@@ -573,57 +574,57 @@
     return m_crypto.get();
 }
 
-BarInfo* DOMWindow::locationbar() const
+BarProp* DOMWindow::locationbar() const
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
     if (!m_locationbar)
-        m_locationbar = BarInfo::create(m_frame, BarInfo::Locationbar);
+        m_locationbar = BarProp::create(m_frame, BarProp::Locationbar);
     return m_locationbar.get();
 }
 
-BarInfo* DOMWindow::menubar() const
+BarProp* DOMWindow::menubar() const
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
     if (!m_menubar)
-        m_menubar = BarInfo::create(m_frame, BarInfo::Menubar);
+        m_menubar = BarProp::create(m_frame, BarProp::Menubar);
     return m_menubar.get();
 }
 
-BarInfo* DOMWindow::personalbar() const
+BarProp* DOMWindow::personalbar() const
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
     if (!m_personalbar)
-        m_personalbar = BarInfo::create(m_frame, BarInfo::Personalbar);
+        m_personalbar = BarProp::create(m_frame, BarProp::Personalbar);
     return m_personalbar.get();
 }
 
-BarInfo* DOMWindow::scrollbars() const
+BarProp* DOMWindow::scrollbars() const
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
     if (!m_scrollbars)
-        m_scrollbars = BarInfo::create(m_frame, BarInfo::Scrollbars);
+        m_scrollbars = BarProp::create(m_frame, BarProp::Scrollbars);
     return m_scrollbars.get();
 }
 
-BarInfo* DOMWindow::statusbar() const
+BarProp* DOMWindow::statusbar() const
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
     if (!m_statusbar)
-        m_statusbar = BarInfo::create(m_frame, BarInfo::Statusbar);
+        m_statusbar = BarProp::create(m_frame, BarProp::Statusbar);
     return m_statusbar.get();
 }
 
-BarInfo* DOMWindow::toolbar() const
+BarProp* DOMWindow::toolbar() const
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
     if (!m_toolbar)
-        m_toolbar = BarInfo::create(m_frame, BarInfo::Toolbar);
+        m_toolbar = BarProp::create(m_frame, BarProp::Toolbar);
     return m_toolbar.get();
 }
 
diff --git a/Source/core/page/DOMWindow.h b/Source/core/page/DOMWindow.h
index 206e46c..3487c4a 100644
--- a/Source/core/page/DOMWindow.h
+++ b/Source/core/page/DOMWindow.h
@@ -27,6 +27,7 @@
 #ifndef DOMWindow_h
 #define DOMWindow_h
 
+#include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/ContextDestructionObserver.h"
 #include "core/dom/EventTarget.h"
 #include "core/page/FrameDestructionObserver.h"
@@ -34,8 +35,7 @@
 #include "core/platform/Supplementable.h"
 
 namespace WebCore {
-
-    class BarInfo;
+    class BarProp;
     class CSSRuleList;
     class CSSStyleDeclaration;
     class Console;
@@ -82,11 +82,7 @@
     enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForwardList };
 
     // FIXME: DOMWindow shouldn't subclass FrameDestructionObserver and instead should get to Frame via its Document.
-    class DOMWindow : public RefCounted<DOMWindow>
-                    , public EventTarget
-                    , public ContextDestructionObserver
-                    , public FrameDestructionObserver
-                    , public Supplementable<DOMWindow> {
+    class DOMWindow : public RefCounted<DOMWindow>, public ScriptWrappable, public EventTarget, public ContextDestructionObserver, public FrameDestructionObserver, public Supplementable<DOMWindow> {
     public:
         static PassRefPtr<DOMWindow> create(Document* document) { return adoptRef(new DOMWindow(document)); }
         virtual ~DOMWindow();
@@ -129,12 +125,12 @@
         Screen* screen() const;
         History* history() const;
         Crypto* crypto() const;
-        BarInfo* locationbar() const;
-        BarInfo* menubar() const;
-        BarInfo* personalbar() const;
-        BarInfo* scrollbars() const;
-        BarInfo* statusbar() const;
-        BarInfo* toolbar() const;
+        BarProp* locationbar() const;
+        BarProp* menubar() const;
+        BarProp* personalbar() const;
+        BarProp* scrollbars() const;
+        BarProp* statusbar() const;
+        BarProp* toolbar() const;
         Navigator* navigator() const;
         Navigator* clientInformation() const { return navigator(); }
 
@@ -411,12 +407,12 @@
         mutable RefPtr<Screen> m_screen;
         mutable RefPtr<History> m_history;
         mutable RefPtr<Crypto>  m_crypto;
-        mutable RefPtr<BarInfo> m_locationbar;
-        mutable RefPtr<BarInfo> m_menubar;
-        mutable RefPtr<BarInfo> m_personalbar;
-        mutable RefPtr<BarInfo> m_scrollbars;
-        mutable RefPtr<BarInfo> m_statusbar;
-        mutable RefPtr<BarInfo> m_toolbar;
+        mutable RefPtr<BarProp> m_locationbar;
+        mutable RefPtr<BarProp> m_menubar;
+        mutable RefPtr<BarProp> m_personalbar;
+        mutable RefPtr<BarProp> m_scrollbars;
+        mutable RefPtr<BarProp> m_statusbar;
+        mutable RefPtr<BarProp> m_toolbar;
         mutable RefPtr<Console> m_console;
         mutable RefPtr<Navigator> m_navigator;
         mutable RefPtr<Location> m_location;
diff --git a/Source/core/page/DOMWindow.idl b/Source/core/page/DOMWindow.idl
index d04ac7a..1827cd3 100644
--- a/Source/core/page/DOMWindow.idl
+++ b/Source/core/page/DOMWindow.idl
@@ -36,19 +36,19 @@
     // DOM Level 0
     [Replaceable] readonly attribute Screen screen;
     [Replaceable] readonly attribute History history;
-    [Replaceable] readonly attribute BarInfo locationbar;
-    [Replaceable] readonly attribute BarInfo menubar;
-    [Replaceable] readonly attribute BarInfo personalbar;
-    [Replaceable] readonly attribute BarInfo scrollbars;
-    [Replaceable] readonly attribute BarInfo statusbar;
-    [Replaceable] readonly attribute BarInfo toolbar;
+    [Replaceable] readonly attribute BarProp locationbar;
+    [Replaceable] readonly attribute BarProp menubar;
+    [Replaceable] readonly attribute BarProp personalbar;
+    [Replaceable] readonly attribute BarProp scrollbars;
+    [Replaceable] readonly attribute BarProp statusbar;
+    [Replaceable] readonly attribute BarProp toolbar;
     [Replaceable, PerWorldBindings, ActivityLog=GetterForIsolatedWorlds] readonly attribute Navigator navigator;
     [Replaceable] readonly attribute Navigator clientInformation;
     readonly attribute Crypto crypto;
     [DoNotCheckSecurity, CustomSetter, Unforgeable, Replaceable] readonly attribute Location location;
     [MeasureAs=WindowEvent, NotEnumerable, Replaceable, CustomGetter, CustomSetter] readonly attribute Event event;
 
-    DOMSelection getSelection();
+    Selection getSelection();
 
     [CheckSecurityForNode] readonly attribute Element frameElement;
 
@@ -182,7 +182,7 @@
     [RaisesException] DOMString atob([TreatNullAs=NullString,Default=Undefined] optional DOMString string);
     [RaisesException] DOMString btoa([TreatNullAs=NullString,Default=Undefined] optional DOMString string);
 
-    [Replaceable] readonly attribute DOMWindowCSS CSS;
+    [Replaceable] readonly attribute CSS CSS;
 
     // Events
     attribute EventListener onabort;
@@ -289,7 +289,7 @@
     // Mozilla has a separate XMLDocument object for XML documents.
     // We just use Document for this.
     attribute DocumentConstructor XMLDocument;
-    attribute DOMURLConstructor webkitURL; // FIXME: deprecate this.
+    attribute URLConstructor webkitURL; // FIXME: deprecate this.
     attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Add metrics to determine when we can remove this.
     attribute IDBCursorConstructor webkitIDBCursor;
     attribute IDBDatabaseConstructor webkitIDBDatabase;
@@ -300,6 +300,10 @@
     attribute IDBRequestConstructor webkitIDBRequest;
     attribute IDBTransactionConstructor webkitIDBTransaction;
 
+    [EnabledAtRuntime=webKitMediaSource] attribute WebKitMediaSourceConstructor WebKitMediaSource;
+    [EnabledAtRuntime=webKitMediaSource] attribute WebKitSourceBufferConstructor WebKitSourceBuffer;
+    [EnabledAtRuntime=webKitMediaSource] attribute WebKitSourceBufferListConstructor WebKitSourceBufferList;
+
     // Constructors enabled at runtime but whose interface does not have EnabledAtRuntime
     // extended attribute.
     // FIXME: Remove these.
@@ -330,9 +334,6 @@
     // Constructors whose name does not match the interface name.
     // FIXME: Remove these once [ImplementedAs] is used and once constructor names match interface names.
     attribute ShadowRootConstructor WebKitShadowRoot;
-    [EnabledAtRuntime=mediaSource] attribute MediaSourceConstructor WebKitMediaSource;
-    [EnabledAtRuntime=mediaSource] attribute SourceBufferConstructor WebKitSourceBuffer;
-    [EnabledAtRuntime=mediaSource] attribute SourceBufferListConstructor WebKitSourceBufferList;
     [Conditional=WEB_AUDIO] attribute PannerNodeConstructor webkitAudioPannerNode;
 
     // window.toString() requires special handling in V8
diff --git a/Source/core/page/DragController.cpp b/Source/core/page/DragController.cpp
index 7143d5a..80089df 100644
--- a/Source/core/page/DragController.cpp
+++ b/Source/core/page/DragController.cpp
@@ -38,9 +38,9 @@
 #include "core/dom/Element.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Node.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
 #include "core/dom/TextEvent.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/MoveSelectionCommand.h"
@@ -75,7 +75,7 @@
 #include "core/rendering/RenderFileUploadControl.h"
 #include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderView.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #if OS(WINDOWS)
 #include <windows.h>
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 10aa0c9..9a339bd 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -37,12 +37,12 @@
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/MouseEvent.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/TextEvent.h"
 #include "core/dom/TouchEvent.h"
 #include "core/dom/TouchList.h"
 #include "core/dom/UserTypingGestureIndicator.h"
 #include "core/dom/WheelEvent.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
@@ -949,7 +949,7 @@
         m_frame->document()->updateHoverActiveState(request, result.innerElement());
 
     if (request.disallowsShadowContent())
-        result.setToNonShadowAncestor();
+        result.setToNodesInDocumentTreeScope();
 
     return result;
 }
@@ -1465,7 +1465,7 @@
     if (FrameView* frameView = m_frame->view())
         frameView->mouseMovedInContentArea();  
 
-    hoveredNode.setToNonShadowAncestor();
+    hoveredNode.setToShadowHostIfInUserAgentShadowRoot();
     page->chrome()->mouseDidMoveOverElement(hoveredNode, event.modifierFlags());
     page->chrome()->setToolTip(hoveredNode);
 
diff --git a/Source/core/page/EventSource.cpp b/Source/core/page/EventSource.cpp
index dc60773..7fb6800 100644
--- a/Source/core/page/EventSource.cpp
+++ b/Source/core/page/EventSource.cpp
@@ -53,7 +53,7 @@
 #include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
@@ -131,10 +131,12 @@
     options.sendLoadCallbacks = SendCallbacks;
     options.sniffContent = DoNotSniffContent;
     options.allowCredentials = (origin->canRequest(m_url) || m_withCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+    options.credentialsRequested = m_withCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials;
     options.preflightPolicy = PreventPreflight;
     options.crossOriginRequestPolicy = UseAccessControl;
     options.dataBufferingPolicy = DoNotBufferData;
     options.securityOrigin = origin;
+    options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
 
     m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options);
 
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index c95ddcd..3464637 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -32,7 +32,6 @@
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
@@ -40,7 +39,8 @@
 #include "core/dom/NodeRenderingTraversal.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Range.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/htmlediting.h" // For firstPositionInOrBeforeNode
diff --git a/Source/core/page/Frame.cpp b/Source/core/page/Frame.cpp
index c08e076..850cfdd 100644
--- a/Source/core/page/Frame.cpp
+++ b/Source/core/page/Frame.cpp
@@ -82,6 +82,7 @@
 #include "core/page/UserContentURLPattern.h"
 #include "core/page/animation/AnimationController.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/platform/DragImage.h"
 #include "core/platform/Logging.h"
 #include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/GraphicsContext.h"
@@ -655,10 +656,6 @@
     for (RefPtr<Frame> child = tree()->firstChild(); child; child = child->tree()->nextSibling())
         child->deviceOrPageScaleFactorChanged();
 
-    RenderView* root = contentRenderer();
-    if (root && root->compositor())
-        root->compositor()->deviceOrPageScaleFactorChanged();
-
     m_page->chrome()->client()->deviceOrPageScaleFactorChanged();
 }
 
diff --git a/Source/core/page/Frame.h b/Source/core/page/Frame.h
index 4d4c621..26a7c34 100644
--- a/Source/core/page/Frame.h
+++ b/Source/core/page/Frame.h
@@ -32,9 +32,9 @@
 #include "core/loader/NavigationScheduler.h"
 #include "core/page/AdjustViewSizeOrNot.h"
 #include "core/page/FrameTree.h"
-#include "core/platform/DragImage.h"
 #include "core/platform/ScrollTypes.h"
-#include "core/platform/graphics/IntRect.h"
+#include "core/platform/chromium/DragImageRef.h"
+#include "core/platform/graphics/IntSize.h"
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
@@ -45,12 +45,14 @@
     class Editor;
     class Element;
     class EventHandler;
+    class FloatSize;
     class FrameDestructionObserver;
     class FrameSelection;
     class FrameView;
     class HTMLTableCellElement;
-    class IntRect;
+    class IntPoint;
     class Node;
+    class Range;
     class RenderPart;
     class RenderView;
     class TreeScope;
diff --git a/Source/core/page/History.cpp b/Source/core/page/History.cpp
index 5587d25..cffbd1c 100644
--- a/Source/core/page/History.cpp
+++ b/Source/core/page/History.cpp
@@ -36,7 +36,7 @@
 #include "core/loader/FrameLoaderClient.h"
 #include "core/page/Frame.h"
 #include "core/page/Page.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/History.idl b/Source/core/page/History.idl
index 6fee491..40e6648 100644
--- a/Source/core/page/History.idl
+++ b/Source/core/page/History.idl
@@ -23,9 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    NoInterfaceObject,
-] interface History {
+interface History {
     readonly attribute unsigned long length;
     [CachedAttribute, Custom] readonly attribute SerializedScriptValue state;
 
diff --git a/Source/core/page/Location.cpp b/Source/core/page/Location.cpp
index b3ef22c..3a20a57 100644
--- a/Source/core/page/Location.cpp
+++ b/Source/core/page/Location.cpp
@@ -35,7 +35,7 @@
 #include "core/page/DOMWindow.h"
 #include "core/page/Frame.h"
 #include "core/platform/KURL.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/Location.idl b/Source/core/page/Location.idl
index 5fea1b4..9bcae96 100644
--- a/Source/core/page/Location.idl
+++ b/Source/core/page/Location.idl
@@ -27,7 +27,6 @@
  */
 
 [
-    NoInterfaceObject,
     CheckSecurity,
     CustomNamedSetter,
     CustomDeleteProperty,
diff --git a/Source/core/page/MemoryInfo.cpp b/Source/core/page/MemoryInfo.cpp
index 8d3fe32..c094e02 100644
--- a/Source/core/page/MemoryInfo.cpp
+++ b/Source/core/page/MemoryInfo.cpp
@@ -35,8 +35,9 @@
 #include "bindings/v8/ScriptGCEvent.h"
 #include "core/page/Frame.h"
 #include "core/page/Settings.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/MainThread.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/MainThread.h"
+#include "wtf/MathExtras.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/Navigator.cpp b/Source/core/page/Navigator.cpp
index 0978731..8f8beae 100644
--- a/Source/core/page/Navigator.cpp
+++ b/Source/core/page/Navigator.cpp
@@ -39,7 +39,7 @@
 #include "core/plugins/PluginData.h"
 #include "core/storage/StorageNamespace.h"
 #include "modules/geolocation/Geolocation.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/Navigator.idl b/Source/core/page/Navigator.idl
index 36df235..ad2bb5c 100644
--- a/Source/core/page/Navigator.idl
+++ b/Source/core/page/Navigator.idl
@@ -17,9 +17,7 @@
     Boston, MA 02110-1301, USA.
 */
 
-[
-    NoInterfaceObject,
-] interface Navigator {
+interface Navigator {
     readonly attribute DOMString appCodeName;
     readonly attribute DOMString appName;
     readonly attribute DOMString appVersion;
diff --git a/Source/core/page/Page.cpp b/Source/core/page/Page.cpp
index 6c7942b..f55a559 100644
--- a/Source/core/page/Page.cpp
+++ b/Source/core/page/Page.cpp
@@ -56,7 +56,6 @@
 #include "core/page/Navigator.h"
 #include "core/page/PageConsole.h"
 #include "core/page/PageGroup.h"
-#include "core/page/PlugInClient.h"
 #include "core/page/PointerLockController.h"
 #include "RuntimeEnabledFeatures.h"
 #include "core/page/Settings.h"
@@ -74,7 +73,7 @@
 #include "core/rendering/RenderWidget.h"
 #include "core/storage/StorageArea.h"
 #include "core/storage/StorageNamespace.h"
-#include "origin/SchemeRegistry.h"
+#include "weborigin/SchemeRegistry.h"
 #include "wtf/HashMap.h"
 #include "wtf/RefCountedLeakCounter.h"
 #include "wtf/StdLibExtras.h"
@@ -127,7 +126,6 @@
     , m_backForwardController(BackForwardController::create(this, pageClients.backForwardClient))
     , m_theme(RenderTheme::themeForPage(this))
     , m_editorClient(pageClients.editorClient)
-    , m_plugInClient(pageClients.plugInClient)
     , m_validationMessageClient(0)
     , m_subframeCount(0)
     , m_openedByDOM(false)
@@ -178,9 +176,6 @@
         frame->detachFromPage();
     }
 
-    if (m_plugInClient)
-        m_plugInClient->pageDestroyed();
-
     m_inspectorController->inspectedPageDestroyed();
 
     if (m_scrollingCoordinator)
@@ -810,7 +805,6 @@
     info.addMember(m_relevantUnpaintedRegion, "relevantUnpaintedRegion");
 
     info.ignoreMember(m_editorClient);
-    info.ignoreMember(m_plugInClient);
     info.ignoreMember(m_validationMessageClient);
 }
 
@@ -820,13 +814,29 @@
         frame->document()->captionPreferencesChanged();
 }
 
+void Page::addMultisamplingChangedObserver(MultisamplingChangedObserver* observer)
+{
+    m_multisamplingChangedObservers.add(observer);
+}
+
+void Page::removeMultisamplingChangedObserver(MultisamplingChangedObserver* observer)
+{
+    m_multisamplingChangedObservers.remove(observer);
+}
+
+void Page::multisamplingChanged()
+{
+    HashSet<MultisamplingChangedObserver*>::iterator stop = m_multisamplingChangedObservers.end();
+    for (HashSet<MultisamplingChangedObserver*>::iterator it = m_multisamplingChangedObservers.begin(); it != stop; ++it)
+        (*it)->multisamplingChanged(m_settings->openGLMultisamplingEnabled());
+}
+
 Page::PageClients::PageClients()
     : chromeClient(0)
     , contextMenuClient(0)
     , editorClient(0)
     , dragClient(0)
     , inspectorClient(0)
-    , plugInClient(0)
 {
 }
 
diff --git a/Source/core/page/Page.h b/Source/core/page/Page.h
index 330a685..76b5045 100644
--- a/Source/core/page/Page.h
+++ b/Source/core/page/Page.h
@@ -64,7 +64,6 @@
 class Node;
 class PageConsole;
 class PageGroup;
-class PlugInClient;
 class PluginData;
 class PointerLockController;
 class ProgressTracker;
@@ -110,7 +109,6 @@
         EditorClient* editorClient;
         DragClient* dragClient;
         InspectorClient* inspectorClient;
-        PlugInClient* plugInClient;
         BackForwardClient* backForwardClient;
     };
 
@@ -129,7 +127,6 @@
     PluginData* pluginData() const;
 
     EditorClient* editorClient() const { return m_editorClient; }
-    PlugInClient* plugInClient() const { return m_plugInClient; }
 
     void setMainFrame(PassRefPtr<Frame>);
     Frame* mainFrame() const { return m_mainFrame.get(); }
@@ -254,6 +251,15 @@
 
     double timerAlignmentInterval() const;
 
+    class MultisamplingChangedObserver {
+    public:
+        virtual void multisamplingChanged(bool) = 0;
+    };
+
+    void addMultisamplingChangedObserver(MultisamplingChangedObserver*);
+    void removeMultisamplingChangedObserver(MultisamplingChangedObserver*);
+    void multisamplingChanged();
+
 private:
     void initGroup();
 
@@ -286,7 +292,6 @@
     RefPtr<RenderTheme> m_theme;
 
     EditorClient* m_editorClient;
-    PlugInClient* m_plugInClient;
     ValidationMessageClient* m_validationMessageClient;
 
     UseCounter m_UseCounter;
@@ -333,6 +338,8 @@
 #endif
 
     OwnPtr<PageConsole> m_console;
+
+    HashSet<MultisamplingChangedObserver*> m_multisamplingChangedObservers;
 };
 
 } // namespace WebCore
diff --git a/Source/core/page/Performance.idl b/Source/core/page/Performance.idl
index 7a40deb..cb9d805 100644
--- a/Source/core/page/Performance.idl
+++ b/Source/core/page/Performance.idl
@@ -31,7 +31,6 @@
 
 // See: http://dev.w3.org/2006/webapi/WebTiming/
 [
-    NoInterfaceObject,
     EventTarget,
 ] interface Performance {
     readonly attribute PerformanceNavigation navigation;
diff --git a/Source/core/page/PerformanceEntry.idl b/Source/core/page/PerformanceEntry.idl
index e9fce1e..94638f8 100644
--- a/Source/core/page/PerformanceEntry.idl
+++ b/Source/core/page/PerformanceEntry.idl
@@ -30,7 +30,6 @@
 
 // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PerformanceTimeline/Overview.html
 [
-    NoInterfaceObject,
     CustomToV8,
 ] interface PerformanceEntry {
     readonly attribute DOMString name;
diff --git a/Source/core/page/PerformanceMark.idl b/Source/core/page/PerformanceMark.idl
index db9ff43..6bae83e 100644
--- a/Source/core/page/PerformanceMark.idl
+++ b/Source/core/page/PerformanceMark.idl
@@ -23,7 +23,5 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    NoInterfaceObject,
-] interface PerformanceMark : PerformanceEntry {
+interface PerformanceMark : PerformanceEntry {
 };
diff --git a/Source/core/page/PerformanceMeasure.idl b/Source/core/page/PerformanceMeasure.idl
index 7ff286a..ee032b7 100644
--- a/Source/core/page/PerformanceMeasure.idl
+++ b/Source/core/page/PerformanceMeasure.idl
@@ -23,7 +23,5 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    NoInterfaceObject,
-] interface PerformanceMeasure : PerformanceEntry {
+interface PerformanceMeasure : PerformanceEntry {
 };
diff --git a/Source/core/page/PerformanceNavigation.idl b/Source/core/page/PerformanceNavigation.idl
index d136ae9..cde7a72 100644
--- a/Source/core/page/PerformanceNavigation.idl
+++ b/Source/core/page/PerformanceNavigation.idl
@@ -29,9 +29,7 @@
  */
 
 // See: http://www.w3.org/TR/navigation-timing/
-[
-    NoInterfaceObject,
-] interface PerformanceNavigation {
+interface PerformanceNavigation {
     const unsigned short TYPE_NAVIGATE = 0;
     const unsigned short TYPE_RELOAD = 1;
     const unsigned short TYPE_BACK_FORWARD = 2;
diff --git a/Source/core/page/PerformanceResourceTiming.cpp b/Source/core/page/PerformanceResourceTiming.cpp
index f091cbd..bc296af 100644
--- a/Source/core/page/PerformanceResourceTiming.cpp
+++ b/Source/core/page/PerformanceResourceTiming.cpp
@@ -39,7 +39,7 @@
 #include "core/platform/KURL.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/PerformanceResourceTiming.idl b/Source/core/page/PerformanceResourceTiming.idl
index 632308d..860c91d 100644
--- a/Source/core/page/PerformanceResourceTiming.idl
+++ b/Source/core/page/PerformanceResourceTiming.idl
@@ -29,9 +29,7 @@
  */
 
 // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html
-[
-     NoInterfaceObject,
-] interface PerformanceResourceTiming : PerformanceEntry {
+interface PerformanceResourceTiming : PerformanceEntry {
     readonly attribute DOMString initiatorType;
 
     readonly attribute double redirectStart;
diff --git a/Source/core/page/PerformanceTiming.idl b/Source/core/page/PerformanceTiming.idl
index 2d97303..160e5cc 100644
--- a/Source/core/page/PerformanceTiming.idl
+++ b/Source/core/page/PerformanceTiming.idl
@@ -29,9 +29,7 @@
  */
 
 // See: http://dev.w3.org/2006/webapi/WebTiming/
-[
-     NoInterfaceObject,
-] interface PerformanceTiming {
+interface PerformanceTiming {
     readonly attribute unsigned long long navigationStart;
     readonly attribute unsigned long long unloadEventStart;
     readonly attribute unsigned long long unloadEventEnd;
diff --git a/Source/core/page/PlugInClient.h b/Source/core/page/PlugInClient.h
deleted file mode 100644
index 6582c4e..0000000
--- a/Source/core/page/PlugInClient.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PlugInClient_h
-#define PlugInClient_h
-
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class PlugInClient {
-public:
-    virtual void pageDestroyed() = 0;
-    virtual bool shouldAutoStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) = 0;
-    virtual void didStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) = 0;
-
-protected:
-    virtual ~PlugInClient() { }
-};
-
-}
-#endif // PlugInClient_h
diff --git a/Source/core/page/PrintContext.cpp b/Source/core/page/PrintContext.cpp
index f55049c..a974db1 100644
--- a/Source/core/page/PrintContext.cpp
+++ b/Source/core/page/PrintContext.cpp
@@ -295,11 +295,14 @@
 
     HashMap<String, Element*>::const_iterator end = m_linkedDestinations.end();
     for (HashMap<String, Element*>::const_iterator it = m_linkedDestinations.begin(); it != end; ++it) {
-        IntRect boundingBox = it->value->renderer()->absoluteBoundingBoxRect();
-        if (pageRect.intersects(boundingBox)) {
-            IntPoint point = boundingBox.minXMinYCorner();
-            point.clampNegativeToZero();
-            graphicsContext.addURLTargetAtPoint(it->key, point);
+        RenderObject* renderer = it->value->renderer();
+        if (renderer) {
+            IntRect boundingBox = renderer->absoluteBoundingBoxRect();
+            if (pageRect.intersects(boundingBox)) {
+                IntPoint point = boundingBox.minXMinYCorner();
+                point.clampNegativeToZero();
+                graphicsContext.addURLTargetAtPoint(it->key, point);
+            }
         }
     }
 }
diff --git a/Source/core/page/RuntimeEnabledFeatures.in b/Source/core/page/RuntimeEnabledFeatures.in
index 9598a63..c59a23c 100644
--- a/Source/core/page/RuntimeEnabledFeatures.in
+++ b/Source/core/page/RuntimeEnabledFeatures.in
@@ -29,7 +29,6 @@
 ExperimentalCanvasFeatures status=test
 ExperimentalContentSecurityPolicyFeatures status=experimental
 ExperimentalShadowDOM status=experimental
-ExperimentalWebSocket
 FileSystem status=stable
 FontLoadEvents status=experimental
 Fullscreen status=stable
@@ -37,14 +36,12 @@
 Geolocation status=stable
 IMEAPI status=test
 IndexedDB status=stable
-InputTypeDateTime condition=INPUT_TYPE_DATETIME_INCOMPLETE, status=test
 InputTypeWeek status=stable
 JavaScriptI18NAPI status=stable
 LangAttributeAwareFormControlUI
 LazyLayout
 LocalStorage status=stable
 Media custom
-MediaSource status=stable
 MediaStream status=stable
 Notifications status=stable
 PeerConnection depends_on=MediaStream, status=stable
@@ -55,7 +52,7 @@
 SessionStorage status=stable
 SharedWorker custom
 SpeechInput status=stable
-SpeechSynthesis
+SpeechSynthesis status=experimental
 StyleScoped status=experimental
 Touch status=stable
 VideoTrack status=stable
@@ -63,3 +60,4 @@
 WebAudio condition=WEB_AUDIO, status=stable
 WebMIDI status=test
 WebPInAcceptHeader
+WebKitMediaSource status=stable
diff --git a/Source/core/page/Screen.cpp b/Source/core/page/Screen.cpp
index 9984ba9..cac5441 100644
--- a/Source/core/page/Screen.cpp
+++ b/Source/core/page/Screen.cpp
@@ -46,35 +46,6 @@
     ScriptWrappable::init(this);
 }
 
-unsigned Screen::horizontalDPI() const
-{
-    if (!m_frame)
-        return 0;
-
-    // Used by the testing system, can be set from internals.
-    IntSize override = m_frame->page()->settings()->resolutionOverride();
-    if (!override.isEmpty())
-        return override.width();
-
-    // The DPI is defined as dots per CSS inch and thus not device inch.
-    return m_frame->page()->deviceScaleFactor() * 96;
-}
-
-unsigned Screen::verticalDPI() const
-{
-    // The DPI is defined as dots per CSS inch and thus not device inch.
-    if (!m_frame)
-        return 0;
-
-    // Used by the testing system, can be set from internals.
-    IntSize override = m_frame->page()->settings()->resolutionOverride();
-    if (!override.isEmpty())
-        return override.height();
-
-    // The DPI is defined as dots per CSS inch and thus not device inch.
-    return m_frame->page()->deviceScaleFactor() * 96;
-}
-
 unsigned Screen::height() const
 {
     if (!m_frame)
diff --git a/Source/core/page/Screen.h b/Source/core/page/Screen.h
index b09572e..8537a37 100644
--- a/Source/core/page/Screen.h
+++ b/Source/core/page/Screen.h
@@ -43,8 +43,6 @@
     public:
         static PassRefPtr<Screen> create(Frame *frame) { return adoptRef(new Screen(frame)); }
 
-        unsigned horizontalDPI() const;
-        unsigned verticalDPI() const;
         unsigned height() const;
         unsigned width() const;
         unsigned colorDepth() const;
diff --git a/Source/core/page/Screen.idl b/Source/core/page/Screen.idl
index a722c38..e3df7b0 100644
--- a/Source/core/page/Screen.idl
+++ b/Source/core/page/Screen.idl
@@ -27,9 +27,7 @@
  */
 
 
-[
-    NoInterfaceObject,
-] interface Screen {
+interface Screen {
     readonly attribute unsigned long height;
     readonly attribute unsigned long width;
     readonly attribute unsigned long colorDepth;
diff --git a/Source/core/page/DOMSecurityPolicy.idl b/Source/core/page/SecurityPolicy.idl
similarity index 95%
rename from Source/core/page/DOMSecurityPolicy.idl
rename to Source/core/page/SecurityPolicy.idl
index 2e1aab4..f5651da 100644
--- a/Source/core/page/DOMSecurityPolicy.idl
+++ b/Source/core/page/SecurityPolicy.idl
@@ -23,9 +23,8 @@
  */
 
 [
-    NoInterfaceObject,
-    InterfaceName=SecurityPolicy
-] interface DOMSecurityPolicy {
+    ImplementedAs=DOMSecurityPolicy
+] interface SecurityPolicy {
     readonly attribute boolean allowsEval;
     readonly attribute boolean allowsInlineScript;
     readonly attribute boolean allowsInlineStyle;
diff --git a/Source/core/page/DOMSelection.idl b/Source/core/page/Selection.idl
similarity index 98%
rename from Source/core/page/DOMSelection.idl
rename to Source/core/page/Selection.idl
index f5a6828..1c93773 100644
--- a/Source/core/page/DOMSelection.idl
+++ b/Source/core/page/Selection.idl
@@ -30,8 +30,8 @@
 // This is based off of Mozilla's Selection interface
 // https://developer.mozilla.org/En/DOM/Selection
 [
-    InterfaceName=Selection
-] interface DOMSelection {
+    ImplementedAs=DOMSelection
+] interface Selection {
     readonly attribute Node anchorNode;
     readonly attribute long anchorOffset;
     readonly attribute Node focusNode;
diff --git a/Source/core/page/Settings.cpp b/Source/core/page/Settings.cpp
index e81ec66..516d40b 100644
--- a/Source/core/page/Settings.cpp
+++ b/Source/core/page/Settings.cpp
@@ -261,15 +261,6 @@
     m_page->setNeedsRecalcStyleInAllFrames();
 }
 
-void Settings::setResolutionOverride(const IntSize& densityPerInchOverride)
-{
-    if (m_resolutionDensityPerInchOverride == densityPerInchOverride)
-        return;
-
-    m_resolutionDensityPerInchOverride = densityPerInchOverride;
-    m_page->setNeedsRecalcStyleInAllFrames();
-}
-
 void Settings::setMediaTypeOverride(const String& mediaTypeOverride)
 {
     if (m_mediaTypeOverride == mediaTypeOverride)
@@ -381,4 +372,18 @@
     return gUsesOverlayScrollbars;
 }
 
+void Settings::setOpenGLMultisamplingEnabled(bool flag)
+{
+    if (m_openGLMultisamplingEnabled == flag)
+        return;
+
+    m_openGLMultisamplingEnabled = flag;
+    m_page->multisamplingChanged();
+}
+
+bool Settings::openGLMultisamplingEnabled()
+{
+    return m_openGLMultisamplingEnabled;
+}
+
 } // namespace WebCore
diff --git a/Source/core/page/Settings.h b/Source/core/page/Settings.h
index 7ef12c8..4f5bd4a 100644
--- a/Source/core/page/Settings.h
+++ b/Source/core/page/Settings.h
@@ -104,10 +104,6 @@
     const IntSize& textAutosizingWindowSizeOverride() const { return m_textAutosizingWindowSizeOverride; }
 
     // Only set by Layout Tests.
-    void setResolutionOverride(const IntSize&);
-    const IntSize& resolutionOverride() const { return m_resolutionDensityPerInchOverride; }
-
-    // Only set by Layout Tests.
     void setMediaTypeOverride(const String&);
     const String& mediaTypeOverride() const { return m_mediaTypeOverride; }
 
@@ -160,6 +156,9 @@
     void setTouchEventEmulationEnabled(bool enabled) { m_touchEventEmulationEnabled = enabled; }
     bool isTouchEventEmulationEnabled() const { return m_touchEventEmulationEnabled; }
 
+    void setOpenGLMultisamplingEnabled(bool flag);
+    bool openGLMultisamplingEnabled();
+
 private:
     explicit Settings(Page*);
 
@@ -179,7 +178,6 @@
     float m_textAutosizingFontScaleFactor;
     IntSize m_textAutosizingWindowSizeOverride;
     bool m_textAutosizingEnabled : 1;
-    IntSize m_resolutionDensityPerInchOverride;
 
     SETTINGS_MEMBER_VARIABLES
 
@@ -195,6 +193,7 @@
     bool m_dnsPrefetchingEnabled : 1;
 
     bool m_touchEventEmulationEnabled : 1;
+    bool m_openGLMultisamplingEnabled : 1;
 
     Timer<Settings> m_setImageLoadingSettingsTimer;
     void imageLoadingSettingsTimerFired(Timer<Settings>*);
diff --git a/Source/core/page/Settings.in b/Source/core/page/Settings.in
index 7a4dac5..f77e0b5 100644
--- a/Source/core/page/Settings.in
+++ b/Source/core/page/Settings.in
@@ -76,7 +76,6 @@
 
 webGLEnabled initial=false
 webGLErrorsToConsoleEnabled initial=true
-openGLMultisamplingEnabled initial=true
 privilegedWebGLExtensionsEnabled initial=false
 accelerated2dCanvasEnabled initial=false
 antialiased2dCanvasEnabled initial=true
@@ -136,3 +135,5 @@
 
 # This setting enables touch based text selection and editing.
 touchEditingEnabled initial=false
+
+experimentalWebSocketEnabled initial=false
diff --git a/Source/core/page/SpeechInput.cpp b/Source/core/page/SpeechInput.cpp
index 2025aef..8b10164 100644
--- a/Source/core/page/SpeechInput.cpp
+++ b/Source/core/page/SpeechInput.cpp
@@ -36,7 +36,7 @@
 #include <wtf/PassOwnPtr.h>
 #include "core/page/SpeechInputClient.h"
 #include "core/page/SpeechInputListener.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/TouchAdjustment.cpp b/Source/core/page/TouchAdjustment.cpp
index 530644c..4b5c01a 100644
--- a/Source/core/page/TouchAdjustment.cpp
+++ b/Source/core/page/TouchAdjustment.cpp
@@ -25,8 +25,8 @@
 #include "core/dom/ContainerNode.h"
 #include "core/dom/Node.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/html/HTMLInputElement.h"
diff --git a/Source/core/page/animation/CSSPropertyAnimation.cpp b/Source/core/page/animation/CSSPropertyAnimation.cpp
index 6e72b37..6c30ff6 100644
--- a/Source/core/page/animation/CSSPropertyAnimation.cpp
+++ b/Source/core/page/animation/CSSPropertyAnimation.cpp
@@ -117,7 +117,6 @@
                                    blend(from->blur(), to->blur(), progress),
                                    blend(from->spread(), to->spread(), progress),
                                    blendFunc(anim, from->style(), to->style(), progress),
-                                   from->isWebkitBoxShadow(),
                                    blend(from->color(), to->color(), progress)));
 }
 
@@ -510,19 +509,16 @@
 
 static inline const ShadowData* shadowForBlending(const ShadowData* srcShadow, const ShadowData* otherShadow)
 {
-    DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal, false, Color::transparent));
-    DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, Inset, false, Color::transparent));
-
-    DEFINE_STATIC_LOCAL(ShadowData, defaultWebKitBoxShadowData, (IntPoint(), 0, 0, Normal, true, Color::transparent));
-    DEFINE_STATIC_LOCAL(ShadowData, defaultInsetWebKitBoxShadowData, (IntPoint(), 0, 0, Inset, true, Color::transparent));
+    DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal, Color::transparent));
+    DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, Inset, Color::transparent));
 
     if (srcShadow)
         return srcShadow;
 
     if (otherShadow->style() == Inset)
-        return otherShadow->isWebkitBoxShadow() ? &defaultInsetWebKitBoxShadowData : &defaultInsetShadowData;
+        return &defaultInsetShadowData;
 
-    return otherShadow->isWebkitBoxShadow() ? &defaultWebKitBoxShadowData : &defaultShadowData;
+    return &defaultShadowData;
 }
 
 class PropertyWrapperShadow : public AnimationPropertyWrapperBase {
diff --git a/Source/core/platform/ContextMenuItem.h b/Source/core/platform/ContextMenuItem.h
index 198689c..5793883 100644
--- a/Source/core/platform/ContextMenuItem.h
+++ b/Source/core/platform/ContextMenuItem.h
@@ -109,7 +109,6 @@
         ContextMenuItemTagEnterVideoFullscreen,
         ContextMenuItemTagMediaPlayPause,
         ContextMenuItemTagMediaMute,
-        ContextMenuItemTagDictationAlternative,
         ContextMenuItemTagOpenLinkInThisWindow,
         ContextMenuItemBaseCustomTag = 5000,
         ContextMenuItemCustomTagNoAction = 5998,
diff --git a/Source/core/platform/EventLoop.h b/Source/core/platform/EventLoop.h
deleted file mode 100644
index 128e92b..0000000
--- a/Source/core/platform/EventLoop.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EventLoop_h
-#define EventLoop_h
-
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-
-    class EventLoop {
-        WTF_MAKE_NONCOPYABLE(EventLoop);
-    public:
-        EventLoop()
-            : m_ended(false)
-        {
-        }
-
-        void cycle();
-        bool ended() const { return m_ended; }
-
-    private:
-        bool m_ended;
-    };
-
-} // namespace WebCore
-
-#endif // EventLoop_h
diff --git a/Source/core/platform/FileStream.cpp b/Source/core/platform/FileStream.cpp
deleted file mode 100644
index 38b1a2f..0000000
--- a/Source/core/platform/FileStream.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "core/platform/FileStream.h"
-
-#include "core/platform/FileSystem.h"
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-FileStream::FileStream()
-    : m_handle(invalidPlatformFileHandle)
-    , m_bytesProcessed(0)
-    , m_totalBytesToRead(0)
-{
-}
-
-FileStream::~FileStream()
-{
-    ASSERT(!isHandleValid(m_handle));
-}
-
-// FIXME: To be removed when we switch to using BlobData.
-void FileStream::start()
-{
-}
-
-void FileStream::stop()
-{
-    close();
-}
-
-long long FileStream::getSize(const String& path, double expectedModificationTime)
-{
-    // Check the modification time for the possible file change.
-    time_t modificationTime;
-    if (!getFileModificationTime(path, modificationTime))
-        return -1;
-    if (isValidFileTime(expectedModificationTime)) {
-        if (static_cast<time_t>(expectedModificationTime) != modificationTime)
-            return -1;
-    }
-
-    // Now get the file size.
-    long long length;
-    if (!getFileSize(path, length))
-        return -1;
-
-    return length;
-}
-
-bool FileStream::open(const String& path, long long offset, long long length)
-{
-    if (isHandleValid(m_handle))
-        return true;
-
-    // Open the file.
-    m_handle = openFile(path, OpenForRead);
-    if (!isHandleValid(m_handle))
-        return false;
-
-    // Jump to the beginning position if the file has been sliced.
-    if (offset > 0) {
-        if (seekFile(m_handle, offset, SeekFromBeginning) < 0)
-            return false;
-    }
-
-    m_totalBytesToRead = length;
-    m_bytesProcessed = 0;
-
-    return true;
-}
-
-void FileStream::close()
-{
-    if (isHandleValid(m_handle)) {
-        closeFile(m_handle);
-        m_handle = invalidPlatformFileHandle;
-    }
-}
-
-int FileStream::read(char* buffer, int bufferSize)
-{
-    if (!isHandleValid(m_handle))
-        return -1;
-
-    long long remaining = m_totalBytesToRead - m_bytesProcessed;
-    int bytesToRead = (remaining < bufferSize) ? static_cast<int>(remaining) : bufferSize;
-    int bytesRead = 0;
-    if (bytesToRead > 0)
-        bytesRead = readFromFile(m_handle, buffer, bytesToRead);
-    if (bytesRead < 0)
-        return -1;
-    if (bytesRead > 0)
-        m_bytesProcessed += bytesRead;
-
-    return bytesRead;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/FileStream.h b/Source/core/platform/FileStream.h
deleted file mode 100644
index 421f2d2..0000000
--- a/Source/core/platform/FileStream.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef FileStream_h
-#define FileStream_h
-
-#include "core/platform/FileSystem.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class KURL;
-
-// All methods are synchronous.
-class FileStream : public RefCounted<FileStream> {
-public:
-    static PassRefPtr<FileStream> create()
-    {
-        return adoptRef(new FileStream());
-    }
-    ~FileStream();
-
-    // FIXME: To be removed when we switch to using BlobData.
-    void start();
-
-    // Aborts the operation.
-    void stop();
-
-    // Gets the size of a file. Also validates if the file has been changed or not if the expected modification time is provided, i.e. non-zero.
-    // Returns total number of bytes if successful. -1 otherwise.
-    long long getSize(const String& path, double expectedModificationTime);
-
-    // Opens a file for reading. The reading starts at the specified offset and lasts till the specified length.
-    // Returns true on success. False otherwise.
-    bool open(const String& path, long long offset, long long length);
-
-    // Closes the file.
-    void close();
-
-    // Reads a file into the provided data buffer.
-    // Returns number of bytes being read on success. -1 otherwise.
-    // If 0 is returned, it means that the reading is completed.
-    int read(char* buffer, int length);
-
-private:
-    FileStream();
-
-    PlatformFileHandle m_handle;
-    long long m_bytesProcessed;
-    long long m_totalBytesToRead;
-};
-
-} // namespace WebCore
-
-#endif // FileStream_h
diff --git a/Source/core/platform/FileStreamClient.h b/Source/core/platform/FileStreamClient.h
deleted file mode 100644
index 14fa501..0000000
--- a/Source/core/platform/FileStreamClient.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef FileStreamClient_h
-#define FileStreamClient_h
-
-namespace WebCore {
-
-class FileStreamClient {
-public:
-    virtual void didOpen(bool) { } // false signals failure.
-    virtual void didStop() { }
-    virtual void didGetSize(long long) { } // -1 signals failure.
-    virtual void didRead(int) { } // -1 signals failure.
-    virtual void didWrite(int) { } // -1 signals failure.
-    virtual void didTruncate(bool) { } // false signals failure.
-
-    // FIXME: To be removed when we switch to using BlobData.
-    virtual void didStart() { }
-
-protected:
-    virtual ~FileStreamClient() { }
-};
-
-} // namespace WebCore
-
-#endif // FileStreamClient_h
diff --git a/Source/core/platform/HostWindow.h b/Source/core/platform/HostWindow.h
index f9dd821..0d0cbd7 100644
--- a/Source/core/platform/HostWindow.h
+++ b/Source/core/platform/HostWindow.h
@@ -60,9 +60,6 @@
 
     virtual WebKit::WebScreenInfo screenInfo() const = 0;
 
-    // To notify WebKit of scrollbar mode changes.
-    virtual void scrollbarsModeDidChange() const = 0;
-
     // Request that the cursor change.
     virtual void setCursor(const Cursor&) = 0;
 
diff --git a/Source/core/platform/InitializeLogging.h b/Source/core/platform/InitializeLogging.h
deleted file mode 100644
index 8b9a668..0000000
--- a/Source/core/platform/InitializeLogging.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef InitializeLogging_h
-#define InitializeLogging_h
-
-#if !LOG_DISABLED
-
-namespace WebCore {
-
-void initializeLoggingChannelsIfNecessary();
-
-}
-
-#endif // !LOG_DISABLED
-
-
-#endif // InitializeLogging_h
diff --git a/Source/core/platform/KURL.h b/Source/core/platform/KURL.h
index 0a17aef..9e73412 100644
--- a/Source/core/platform/KURL.h
+++ b/Source/core/platform/KURL.h
@@ -29,4 +29,4 @@
  */
 
 // FIXME: Remove this forwarding header.
-#include "origin/KURL.h"
+#include "weborigin/KURL.h"
diff --git a/Source/core/platform/KURLHash.h b/Source/core/platform/KURLHash.h
index 1b8ab71..e6dcd9f 100644
--- a/Source/core/platform/KURLHash.h
+++ b/Source/core/platform/KURLHash.h
@@ -29,4 +29,4 @@
  */
 
 // FIXME: Remove this forwarding header.
-#include "origin/KURLHash.h"
+#include "weborigin/KURLHash.h"
diff --git a/Source/core/platform/PlatformMemoryInstrumentation.cpp b/Source/core/platform/PlatformMemoryInstrumentation.cpp
index 2ece6f7..1f53540 100644
--- a/Source/core/platform/PlatformMemoryInstrumentation.cpp
+++ b/Source/core/platform/PlatformMemoryInstrumentation.cpp
@@ -48,7 +48,7 @@
 void PlatformMemoryInstrumentation::reportStaticMembersMemoryUsage(WTF::MemoryInstrumentation* memoryInstrumentation)
 {
 #if ENABLE(WEB_AUDIO)
-    memoryInstrumentation->addRootObject(HRTFDatabaseLoader::loader());
+    memoryInstrumentation->addRootObject(HRTFDatabaseLoader::loaderMap());
 #else
     UNUSED_PARAM(memoryInstrumentation);
 #endif
diff --git a/Source/core/platform/PrerenderHandle.h b/Source/core/platform/PrerenderHandle.h
index 26e7d6f..f1f1c1b 100644
--- a/Source/core/platform/PrerenderHandle.h
+++ b/Source/core/platform/PrerenderHandle.h
@@ -32,7 +32,7 @@
 #ifndef PrerenderHandle_h
 #define PrerenderHandle_h
 
-#include "origin/ReferrerPolicy.h"
+#include "weborigin/ReferrerPolicy.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
diff --git a/Source/core/platform/ScrollAnimator.cpp b/Source/core/platform/ScrollAnimator.cpp
index 0faa0c0..dc0c7f3 100644
--- a/Source/core/platform/ScrollAnimator.cpp
+++ b/Source/core/platform/ScrollAnimator.cpp
@@ -55,7 +55,7 @@
 bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float multiplier)
 {
     float* currentPos = (orientation == HorizontalScrollbar) ? &m_currentPosX : &m_currentPosY;
-    float newPos = std::max(std::min(*currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0.0f);
+    float newPos = m_scrollableArea->clampScrollPosition(orientation, *currentPos + step * multiplier);
     float delta = *currentPos - newPos;
     if (*currentPos == newPos)
         return false;
diff --git a/Source/core/platform/ScrollView.cpp b/Source/core/platform/ScrollView.cpp
index 575de45..5a06473 100644
--- a/Source/core/platform/ScrollView.cpp
+++ b/Source/core/platform/ScrollView.cpp
@@ -306,18 +306,7 @@
 
 void ScrollView::setScrollOffset(const IntPoint& offset)
 {
-    int horizontalOffset = offset.x();
-    int verticalOffset = offset.y();
-    if (constrainsScrollingToContentEdge()) {
-        horizontalOffset = max(min(horizontalOffset, contentsWidth() - visibleWidth()), 0);
-        verticalOffset = max(min(verticalOffset, contentsHeight() - visibleHeight()), 0);
-    }
-
-    IntSize newOffset = m_scrollOffset;
-    newOffset.setWidth(horizontalOffset - scrollOrigin().x());
-    newOffset.setHeight(verticalOffset - scrollOrigin().y());
-
-    scrollTo(newOffset);
+    scrollTo(toIntSize(adjustScrollPositionWithinRange(offset)));
 }
 
 void ScrollView::scrollTo(const IntSize& newOffset)
@@ -555,7 +544,7 @@
         adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosition);
 
     if (adjustedScrollPosition != scrollPosition() || scrollOriginChanged()) {
-        ScrollableArea::scrollToOffsetWithoutAnimation(adjustedScrollPosition + IntSize(scrollOrigin().x(), scrollOrigin().y()));
+        ScrollableArea::scrollToOffsetWithoutAnimation(adjustedScrollPosition);
         resetScrollOriginChanged();
     }
 
diff --git a/Source/core/platform/ScrollableArea.h b/Source/core/platform/ScrollableArea.h
index 5ba8c9e..4b0b7b6 100644
--- a/Source/core/platform/ScrollableArea.h
+++ b/Source/core/platform/ScrollableArea.h
@@ -174,6 +174,12 @@
 
     virtual void reportMemoryUsage(MemoryObjectInfo*) const;
 
+    // Convenience functions
+    int scrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); }
+    int minimumScrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? minimumScrollPosition().x() : minimumScrollPosition().y(); }
+    int maximumScrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? maximumScrollPosition().x() : maximumScrollPosition().y(); }
+    int clampScrollPosition(ScrollbarOrientation orientation, int pos)  { return std::max(std::min(pos, maximumScrollPosition(orientation)), minimumScrollPosition(orientation)); }
+
 protected:
     ScrollableArea();
     virtual ~ScrollableArea();
diff --git a/Source/core/platform/Scrollbar.cpp b/Source/core/platform/Scrollbar.cpp
index 1811023..9c4c104 100644
--- a/Source/core/platform/Scrollbar.cpp
+++ b/Source/core/platform/Scrollbar.cpp
@@ -295,11 +295,8 @@
             delta = pos - m_documentDragPos;
         m_draggingDocument = true;
         FloatPoint currentPosition = m_scrollableArea->scrollAnimator()->currentPosition();
-        int destinationPosition = (m_orientation == HorizontalScrollbar ? currentPosition.x() : currentPosition.y()) + delta;
-        if (delta > 0)
-            destinationPosition = min(destinationPosition + delta, maximum());
-        else if (delta < 0)
-            destinationPosition = max(destinationPosition + delta, 0);
+        float destinationPosition = (m_orientation == HorizontalScrollbar ? currentPosition.x() : currentPosition.y()) + delta;
+        destinationPosition = m_scrollableArea->clampScrollPosition(m_orientation, destinationPosition);
         m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, destinationPosition);
         m_documentDragPos = pos;
         return;
@@ -314,14 +311,15 @@
     int thumbPos = theme()->thumbPosition(this);
     int thumbLen = theme()->thumbLength(this);
     int trackLen = theme()->trackLength(this);
-    int maxPos = trackLen - thumbLen;
     if (delta > 0)
-        delta = min(maxPos - thumbPos, delta);
+        delta = min(trackLen - thumbLen - thumbPos, delta);
     else if (delta < 0)
         delta = max(-thumbPos, delta);
     
+    float minPos = m_scrollableArea->minimumScrollPosition(m_orientation);
+    float maxPos = m_scrollableArea->maximumScrollPosition(m_orientation);
     if (delta) {
-        float newPosition = static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen);
+        float newPosition = static_cast<float>(thumbPos + delta) * (maxPos - minPos) / (trackLen - thumbLen) + minPos;
         m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, newPosition);
     }
 }
diff --git a/Source/core/platform/audio/FFTFrame.cpp b/Source/core/platform/audio/FFTFrame.cpp
index 358c5bc..35d73b1 100644
--- a/Source/core/platform/audio/FFTFrame.cpp
+++ b/Source/core/platform/audio/FFTFrame.cpp
@@ -263,13 +263,6 @@
     info.addMember(m_imagData, "imagData");
 #else // !USE_ACCELERATE_FFT
 
-#if USE(WEBAUDIO_MKL)
-    info.addMember(m_handle, "handle");
-    info.addMember(m_complexData, "complexData");
-    info.addMember(m_realData, "realData");
-    info.addMember(m_imagData, "imagData");
-#endif // USE(WEBAUDIO_MKL)
-
 #if USE(WEBAUDIO_FFMPEG)
     info.addMember(m_forwardContext, "forwardContext");
     info.addMember(m_inverseContext, "inverseContext");
diff --git a/Source/core/platform/audio/FFTFrame.h b/Source/core/platform/audio/FFTFrame.h
index 32c01f1..8c2cea4 100644
--- a/Source/core/platform/audio/FFTFrame.h
+++ b/Source/core/platform/audio/FFTFrame.h
@@ -43,10 +43,6 @@
 
 #if !USE_ACCELERATE_FFT
 
-#if USE(WEBAUDIO_MKL)
-#include "mkl_dfti.h"
-#endif // USE(WEBAUDIO_MKL)
-
 #if USE(WEBAUDIO_OPENMAX_DL_FFT)
 #include "dl/sp/api/armSP.h"
 #include "dl/sp/api/omxSP.h"
@@ -125,24 +121,6 @@
     AudioFloatArray m_imagData;
 #else // !USE_ACCELERATE_FFT
 
-#if USE(WEBAUDIO_MKL)
-    // Interleaves the planar real and imaginary data and returns a
-    // pointer to the resulting storage which can be used for in-place
-    // or out-of-place operations. FIXME: ideally all of the MKL
-    // routines would operate on planar data and this method would be
-    // removed.
-    float* getUpToDateComplexData();
-
-    static DFTI_DESCRIPTOR_HANDLE descriptorHandleForSize(unsigned fftSize);
-
-    static DFTI_DESCRIPTOR_HANDLE* descriptorHandles;
-
-    DFTI_DESCRIPTOR_HANDLE m_handle;
-    AudioFloatArray m_complexData;
-    AudioFloatArray m_realData;
-    AudioFloatArray m_imagData;
-#endif // USE(WEBAUDIO_MKL)
-
 #if USE(WEBAUDIO_FFMPEG)
     static RDFTContext* contextForSize(unsigned fftSize, int trans);
 
diff --git a/Source/core/platform/audio/FFTFrameStub.cpp b/Source/core/platform/audio/FFTFrameStub.cpp
index f6c0d32..ee98949 100644
--- a/Source/core/platform/audio/FFTFrameStub.cpp
+++ b/Source/core/platform/audio/FFTFrameStub.cpp
@@ -29,7 +29,7 @@
 
 #if ENABLE(WEB_AUDIO)
 
-#if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_IPP) && !USE(WEBAUDIO_OPENMAX_DL_FFT)
+#if !OS(DARWIN) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_IPP) && !USE(WEBAUDIO_OPENMAX_DL_FFT)
 
 #include "core/platform/audio/FFTFrame.h"
 
@@ -102,6 +102,6 @@
 
 } // namespace WebCore
 
-#endif // !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_IPP)
+#endif // !OS(DARWIN) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_IPP) && !USE(WEBAUDIO_OPENMAX_DL_FFT)
 
 #endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/HRTFDatabaseLoader.cpp b/Source/core/platform/audio/HRTFDatabaseLoader.cpp
index b4dc630..94ab4ab 100644
--- a/Source/core/platform/audio/HRTFDatabaseLoader.cpp
+++ b/Source/core/platform/audio/HRTFDatabaseLoader.cpp
@@ -39,7 +39,7 @@
 namespace WebCore {
 
 // Singleton
-HRTFDatabaseLoader* HRTFDatabaseLoader::s_loader = 0;
+HRTFDatabaseLoader::LoaderMap* HRTFDatabaseLoader::s_loaderMap = 0;
 
 PassRefPtr<HRTFDatabaseLoader> HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(float sampleRate)
 {
@@ -47,16 +47,20 @@
 
     RefPtr<HRTFDatabaseLoader> loader;
     
-    if (!s_loader) {
-        // Lazily create and load.
-        loader = adoptRef(new HRTFDatabaseLoader(sampleRate));
-        s_loader = loader.get();
-        loader->loadAsynchronously();
-    } else {
-        loader = s_loader;
+    if (!s_loaderMap)
+        s_loaderMap = adoptPtr(new LoaderMap()).leakPtr();
+
+    loader = s_loaderMap->get(sampleRate);
+    if (loader) {
         ASSERT(sampleRate == loader->databaseSampleRate());
+        return loader;
     }
-    
+
+    loader = adoptRef(new HRTFDatabaseLoader(sampleRate));
+    s_loaderMap->add(sampleRate, loader.get());
+
+    loader->loadAsynchronously();
+
     return loader;
 }
 
@@ -73,12 +77,11 @@
 
     waitForLoaderThreadCompletion();
     m_hrtfDatabase.clear();
-    
-    // Clear out singleton.
-    ASSERT(this == s_loader);
-    s_loader = 0;
-}
 
+    // Remove ourself from the map.
+    if (s_loaderMap)
+        s_loaderMap->remove(m_databaseSampleRate);
+}
 
 // Asynchronously load the database in this thread.
 static void databaseLoaderEntry(void* threadData)
@@ -124,20 +127,24 @@
     m_databaseLoaderThread = 0;
 }
 
-HRTFDatabase* HRTFDatabaseLoader::defaultHRTFDatabase()
-{
-    if (!s_loader)
-        return 0;
-    
-    return s_loader->database();
-}
-
 void HRTFDatabaseLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::AudioSharedData);
     info.addMember(m_hrtfDatabase, "hrtfDatabase");
 }
 
+void HRTFDatabaseLoader::LoaderMap::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    ASSERT(isMainThread());
+
+    if (s_loaderMap) {
+        for (HRTFDatabaseLoader::LoaderMap::iterator i = s_loaderMap->begin(); i != s_loaderMap->end(); ++i) {
+            HRTFDatabaseLoader* loader = i.get()->value;
+            loader->reportMemoryUsage(memoryObjectInfo);
+        }
+    }
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/HRTFDatabaseLoader.h b/Source/core/platform/audio/HRTFDatabaseLoader.h
index 4562db7..701ddb3 100644
--- a/Source/core/platform/audio/HRTFDatabaseLoader.h
+++ b/Source/core/platform/audio/HRTFDatabaseLoader.h
@@ -30,10 +30,11 @@
 #define HRTFDatabaseLoader_h
 
 #include "core/platform/audio/HRTFDatabase.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Threading.h>
+#include "wtf/HashMap.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Threading.h"
 
 namespace WebCore {
 
@@ -41,14 +42,12 @@
 
 class HRTFDatabaseLoader : public RefCounted<HRTFDatabaseLoader> {
 public:
-    // Lazily creates the singleton HRTFDatabaseLoader (if not already created) and starts loading asynchronously (when created the first time).
-    // Returns the singleton HRTFDatabaseLoader.
+    // Lazily creates a HRTFDatabaseLoader (if not already created) for the given sample-rate
+    // and starts loading asynchronously (when created the first time).
+    // Returns the HRTFDatabaseLoader.
     // Must be called from the main thread.
     static PassRefPtr<HRTFDatabaseLoader> createAndLoadAsynchronouslyIfNecessary(float sampleRate);
 
-    // Returns the singleton HRTFDatabaseLoader.
-    static HRTFDatabaseLoader* loader() { return s_loader; }
-    
     // Both constructor and destructor must be called from the main thread.
     ~HRTFDatabaseLoader();
     
@@ -65,13 +64,16 @@
     // Called in asynchronous loading thread.
     void load();
 
-    // defaultHRTFDatabase() gives access to the loaded database.
-    // This can be called from any thread, but it is the callers responsibilty to call this while the context (and thus HRTFDatabaseLoader)
-    // is still alive.  Otherwise this will return 0.
-    static HRTFDatabase* defaultHRTFDatabase();
-
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
+    // Map from sample-rate to loader.
+    class LoaderMap : public HashMap<double, HRTFDatabaseLoader*> {
+    public:
+        void reportMemoryUsage(MemoryObjectInfo*) const;
+    };
+
+    static HRTFDatabaseLoader::LoaderMap* loaderMap() { return s_loaderMap; }
+
 private:
     // Both constructor and destructor must be called from the main thread.
     explicit HRTFDatabaseLoader(float sampleRate);
@@ -80,7 +82,9 @@
     // This must be called from the main thread.
     void loadAsynchronously();
 
-    static HRTFDatabaseLoader* s_loader; // singleton
+    // Keeps track of loaders on a per-sample-rate basis.
+    static LoaderMap* s_loaderMap; // singleton
+
     OwnPtr<HRTFDatabase> m_hrtfDatabase;
 
     // Holding a m_threadLock is required when accessing m_databaseLoaderThread.
diff --git a/Source/core/platform/audio/HRTFPanner.cpp b/Source/core/platform/audio/HRTFPanner.cpp
index 44c8598..39c13d2 100644
--- a/Source/core/platform/audio/HRTFPanner.cpp
+++ b/Source/core/platform/audio/HRTFPanner.cpp
@@ -32,7 +32,6 @@
 #include "core/platform/audio/AudioBus.h"
 #include "core/platform/audio/FFTConvolver.h"
 #include "core/platform/audio/HRTFDatabase.h"
-#include "core/platform/audio/HRTFDatabaseLoader.h"
 #include <wtf/MathExtras.h>
 #include <wtf/RefPtr.h>
 
@@ -47,8 +46,9 @@
 const int UninitializedAzimuth = -1;
 const unsigned RenderingQuantum = 128;
 
-HRTFPanner::HRTFPanner(float sampleRate)
+HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader)
     : Panner(PanningModelHRTF)
+    , m_databaseLoader(databaseLoader)
     , m_sampleRate(sampleRate)
     , m_crossfadeSelection(CrossfadeSelection1)
     , m_azimuthIndex1(UninitializedAzimuth)
@@ -68,6 +68,7 @@
     , m_tempL2(RenderingQuantum)
     , m_tempR2(RenderingQuantum)
 {
+    ASSERT(databaseLoader);
 }
 
 HRTFPanner::~HRTFPanner()
@@ -100,7 +101,7 @@
     if (azimuth < 0)
         azimuth += 360.0;
 
-    HRTFDatabase* database = HRTFDatabaseLoader::defaultHRTFDatabase();
+    HRTFDatabase* database = m_databaseLoader->database();
     ASSERT(database);
 
     int numberOfAzimuths = database->numberOfAzimuths();
@@ -134,8 +135,7 @@
         return;
     }
 
-    // This code only runs as long as the context is alive and after database has been loaded.
-    HRTFDatabase* database = HRTFDatabaseLoader::defaultHRTFDatabase();
+    HRTFDatabase* database = m_databaseLoader->database();
     ASSERT(database);
     if (!database) {
         outputBus->zero();
diff --git a/Source/core/platform/audio/HRTFPanner.h b/Source/core/platform/audio/HRTFPanner.h
index 235f82b..1e63ddd 100644
--- a/Source/core/platform/audio/HRTFPanner.h
+++ b/Source/core/platform/audio/HRTFPanner.h
@@ -26,6 +26,7 @@
 #define HRTFPanner_h
 
 #include "core/platform/audio/FFTConvolver.h"
+#include "core/platform/audio/HRTFDatabaseLoader.h"
 #include "core/platform/audio/Panner.h"
 #include "modules/webaudio/DelayDSPKernel.h"
 
@@ -33,7 +34,7 @@
 
 class HRTFPanner : public Panner {
 public:
-    explicit HRTFPanner(float sampleRate);
+    HRTFPanner(float sampleRate, HRTFDatabaseLoader*);
     virtual ~HRTFPanner();
 
     // Panner
@@ -53,6 +54,8 @@
     // and azimuthBlend which is an interpolation value from 0 -> 1.
     int calculateDesiredAzimuthIndexAndBlend(double azimuth, double& azimuthBlend);
 
+    RefPtr<HRTFDatabaseLoader> m_databaseLoader;
+
     float m_sampleRate;
 
     // We maintain two sets of convolvers for smooth cross-faded interpolations when
diff --git a/Source/core/platform/audio/Panner.cpp b/Source/core/platform/audio/Panner.cpp
index 8bd0a04..96ca460 100644
--- a/Source/core/platform/audio/Panner.cpp
+++ b/Source/core/platform/audio/Panner.cpp
@@ -38,7 +38,7 @@
 
 namespace WebCore {
 
-PassOwnPtr<Panner> Panner::create(PanningModel model, float sampleRate)
+PassOwnPtr<Panner> Panner::create(PanningModel model, float sampleRate, HRTFDatabaseLoader* databaseLoader)
 {
     OwnPtr<Panner> panner;
 
@@ -48,7 +48,7 @@
         break;
 
     case PanningModelHRTF:
-        panner = adoptPtr(new HRTFPanner(sampleRate));
+        panner = adoptPtr(new HRTFPanner(sampleRate, databaseLoader));
         break;
 
     // FIXME: sound field panning is not yet implemented...
diff --git a/Source/core/platform/audio/Panner.h b/Source/core/platform/audio/Panner.h
index f8b240e..efd76d8 100644
--- a/Source/core/platform/audio/Panner.h
+++ b/Source/core/platform/audio/Panner.h
@@ -34,6 +34,7 @@
 namespace WebCore {
 
 class AudioBus;
+class HRTFDatabaseLoader;
 
 // Abstract base class for panning a mono or stereo source.
 
@@ -47,7 +48,7 @@
     
     typedef unsigned PanningModel;
 
-    static PassOwnPtr<Panner> create(PanningModel, float sampleRate);
+    static PassOwnPtr<Panner> create(PanningModel, float sampleRate, HRTFDatabaseLoader*);
 
     virtual ~Panner() { };
 
diff --git a/Source/core/platform/audio/mkl/FFTFrameMKL.cpp b/Source/core/platform/audio/mkl/FFTFrameMKL.cpp
deleted file mode 100644
index 3a2c108..0000000
--- a/Source/core/platform/audio/mkl/FFTFrameMKL.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// FFTFrame implementation using Intel's Math Kernel Library (MKL),
-// suitable for use on Windows and Linux.
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#if !OS(DARWIN) && USE(WEBAUDIO_MKL)
-
-#include "core/platform/audio/FFTFrame.h"
-
-#include "mkl_vml.h"
-#include <wtf/MathExtras.h>
-
-namespace {
-
-DFTI_DESCRIPTOR_HANDLE createDescriptorHandle(int fftSize)
-{
-    DFTI_DESCRIPTOR_HANDLE handle = 0;
-
-    // Create DFTI descriptor for 1D single precision transform.
-    MKL_LONG status = DftiCreateDescriptor(&handle, DFTI_SINGLE, DFTI_REAL, 1, fftSize);
-    ASSERT(DftiErrorClass(status, DFTI_NO_ERROR));
-
-    // Set placement of result to DFTI_NOT_INPLACE.
-    status = DftiSetValue(handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
-    ASSERT(DftiErrorClass(status, DFTI_NO_ERROR));
-
-    // Set packing format to PERM; this produces the layout which
-    // matches Accelerate.framework's on the Mac, though interleaved.
-    status = DftiSetValue(handle, DFTI_PACKED_FORMAT, DFTI_PERM_FORMAT);
-    ASSERT(DftiErrorClass(status, DFTI_NO_ERROR));
-
-    // Set the forward scale factor to 2 to match Accelerate.framework's.
-    // FIXME: FFTFrameMac's scaling factor could be fixed to be 1.0,
-    // in which case this code would need to be changed as well.
-    status = DftiSetValue(handle, DFTI_FORWARD_SCALE, 2.0);
-    ASSERT(DftiErrorClass(status, DFTI_NO_ERROR));
-
-    // Set the backward scale factor to 1 / 2n to match Accelerate.framework's.
-    // FIXME: if the above scaling factor is fixed then this needs to be as well.
-    double scale = 1.0 / (2.0 * fftSize);
-    status = DftiSetValue(handle, DFTI_BACKWARD_SCALE, scale);
-    ASSERT(DftiErrorClass(status, DFTI_NO_ERROR));
-
-    // Use the default DFTI_CONJUGATE_EVEN_STORAGE = DFTI_COMPLEX_REAL.
-
-    // Commit DFTI descriptor.
-    status = DftiCommitDescriptor(handle);
-    ASSERT(DftiErrorClass(status, DFTI_NO_ERROR));
-
-    return handle;
-}
-
-} // anonymous namespace
-
-namespace WebCore {
-
-const int kMaxFFTPow2Size = 24;
-
-DFTI_DESCRIPTOR_HANDLE* FFTFrame::descriptorHandles = 0;
-
-// Normal constructor: allocates for a given fftSize.
-FFTFrame::FFTFrame(unsigned fftSize)
-    : m_FFTSize(fftSize)
-    , m_log2FFTSize(static_cast<unsigned>(log2(fftSize)))
-    , m_handle(0)
-    , m_complexData(fftSize)
-    , m_realData(fftSize / 2)
-    , m_imagData(fftSize / 2)
-{
-    // We only allow power of two.
-    ASSERT(1UL << m_log2FFTSize == m_FFTSize);
-
-    m_handle = descriptorHandleForSize(fftSize);
-}
-
-// Creates a blank/empty frame (interpolate() must later be called).
-FFTFrame::FFTFrame()
-    : m_FFTSize(0)
-    , m_log2FFTSize(0)
-    , m_handle(0)
-{
-}
-
-// Copy constructor.
-FFTFrame::FFTFrame(const FFTFrame& frame)
-    : m_FFTSize(frame.m_FFTSize)
-    , m_log2FFTSize(frame.m_log2FFTSize)
-    , m_handle(0)
-    , m_complexData(frame.m_FFTSize)
-    , m_realData(frame.m_FFTSize / 2)
-    , m_imagData(frame.m_FFTSize / 2)
-{
-    m_handle = descriptorHandleForSize(m_FFTSize);
-
-    // Copy/setup frame data.
-    unsigned nbytes = sizeof(float) * (m_FFTSize / 2);
-    memcpy(realData(), frame.realData(), nbytes);
-    memcpy(imagData(), frame.imagData(), nbytes);
-}
-
-FFTFrame::~FFTFrame()
-{
-}
-
-void FFTFrame::multiply(const FFTFrame& frame)
-{
-    FFTFrame& frame1 = *this;
-    FFTFrame& frame2 = const_cast<FFTFrame&>(frame);
-
-    float* realP1 = frame1.realData();
-    float* imagP1 = frame1.imagData();
-    const float* realP2 = frame2.realData();
-    const float* imagP2 = frame2.imagData();
-
-    // Scale accounts for vecLib's peculiar scaling.
-    // This ensures the right scaling all the way back to inverse FFT.
-    // FIXME: this scaling factor will be 1.0f if the above 2.0 -> 1.0
-    // scaling factor is fixed.
-    float scale = 0.5f;
-
-    // Multiply packed DC/nyquist component.
-    realP1[0] *= scale * realP2[0];
-    imagP1[0] *= scale * imagP2[0];
-
-    // Multiply the rest, skipping packed DC/Nyquist components.
-    float* interleavedData1 = frame1.getUpToDateComplexData();
-    float* interleavedData2 = frame2.getUpToDateComplexData();
-
-    unsigned halfSize = m_FFTSize / 2;
-
-    // Complex multiply.
-    vcMul(halfSize - 1,
-          reinterpret_cast<MKL_Complex8*>(interleavedData1) + 1,
-          reinterpret_cast<MKL_Complex8*>(interleavedData2) + 1,
-          reinterpret_cast<MKL_Complex8*>(interleavedData1) + 1);
-
-    // De-interleave and scale the rest of the data.
-    // FIXME: find an MKL routine to do at least the scaling more efficiently.
-    for (unsigned i = 1; i < halfSize; ++i) {
-        int baseComplexIndex = 2 * i;
-        realP1[i] = scale * interleavedData1[baseComplexIndex];
-        imagP1[i] = scale * interleavedData1[baseComplexIndex + 1];
-    }
-}
-
-void FFTFrame::doFFT(const float* data)
-{
-    // Compute Forward transform.
-    MKL_LONG status = DftiComputeForward(m_handle, data, m_complexData.data());
-    ASSERT_UNUSED(status, DftiErrorClass(status, DFTI_NO_ERROR));
-
-    // De-interleave to separate real and complex arrays. FIXME:
-    // figure out if it's possible to get MKL to use split-complex
-    // form for 1D real-to-complex out-of-place FFTs.
-    int len = m_FFTSize / 2;
-    for (int i = 0; i < len; ++i) {
-        int baseComplexIndex = 2 * i;
-        // m_realData[0] is the DC component and m_imagData[0] the
-        // Nyquist component since the interleaved complex data is
-        // packed.
-        m_realData[i] = m_complexData[baseComplexIndex];
-        m_imagData[i] = m_complexData[baseComplexIndex + 1];
-    }
-}
-
-void FFTFrame::doInverseFFT(float* data)
-{
-    // Prepare interleaved data. FIXME: figure out if it's possible to
-    // get MKL to use split-complex form for 1D backward
-    // (complex-to-real) out-of-place FFTs.
-    float* interleavedData = getUpToDateComplexData();
-
-    // Compute backward transform.
-    MKL_LONG status = DftiComputeBackward(m_handle, interleavedData, data);
-    ASSERT_UNUSED(status, DftiErrorClass(status, DFTI_NO_ERROR));
-}
-
-void FFTFrame::initialize()
-{
-}
-
-void FFTFrame::cleanup()
-{
-    if (!descriptorHandles)
-        return;
-
-    for (int i = 0; i < kMaxFFTPow2Size; ++i) {
-        if (descriptorHandles[i]) {
-            MKL_LONG status = DftiFreeDescriptor(&descriptorHandles[i]);
-            ASSERT_UNUSED(status, DftiErrorClass(status, DFTI_NO_ERROR));
-        }
-    }
-
-    delete[] descriptorHandles;
-    descriptorHandles = 0;
-}
-
-float* FFTFrame::realData() const
-{
-    return const_cast<float*>(m_realData.data());
-}
-
-float* FFTFrame::imagData() const
-{
-    return const_cast<float*>(m_imagData.data());
-}
-
-float* FFTFrame::getUpToDateComplexData()
-{
-    // FIXME: if we can't completely get rid of this method, SSE
-    // optimization could be considered if it shows up hot on profiles.
-    int len = m_FFTSize / 2;
-    for (int i = 0; i < len; ++i) {
-        int baseComplexIndex = 2 * i;
-        m_complexData[baseComplexIndex] = m_realData[i];
-        m_complexData[baseComplexIndex + 1] = m_imagData[i];
-    }
-    return const_cast<float*>(m_complexData.data());
-}
-
-DFTI_DESCRIPTOR_HANDLE FFTFrame::descriptorHandleForSize(unsigned fftSize)
-{
-    if (!descriptorHandles) {
-        descriptorHandles = new DFTI_DESCRIPTOR_HANDLE[kMaxFFTPow2Size];
-        for (int i = 0; i < kMaxFFTPow2Size; ++i)
-            descriptorHandles[i] = 0;
-    }
-
-    ASSERT(fftSize);
-    int pow2size = static_cast<int>(log2(fftSize));
-    ASSERT(pow2size < kMaxFFTPow2Size);
-    if (!descriptorHandles[pow2size])
-        descriptorHandles[pow2size] = createDescriptorHandle(fftSize);
-    return descriptorHandles[pow2size];
-}
-
-} // namespace WebCore
-
-#endif // !OS(DARWIN) && USE(WEBAUDIO_MKL)
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/chromium/Prerender.h b/Source/core/platform/chromium/Prerender.h
index 00ceb06..d1b63a4 100644
--- a/Source/core/platform/chromium/Prerender.h
+++ b/Source/core/platform/chromium/Prerender.h
@@ -33,7 +33,7 @@
 #define Prerender_h
 
 #include "core/platform/KURL.h"
-#include "origin/ReferrerPolicy.h"
+#include "weborigin/ReferrerPolicy.h"
 #include <public/WebSize.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
diff --git a/Source/core/platform/chromium/PrerenderHandle.cpp b/Source/core/platform/chromium/PrerenderHandle.cpp
index bac4771..03874e7 100644
--- a/Source/core/platform/chromium/PrerenderHandle.cpp
+++ b/Source/core/platform/chromium/PrerenderHandle.cpp
@@ -36,7 +36,7 @@
 #include <wtf/text/WTFString.h>
 #include "core/platform/KURL.h"
 #include "core/platform/chromium/Prerender.h"
-#include "origin/ReferrerPolicy.h"
+#include "weborigin/ReferrerPolicy.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/chromium/support/WebActiveGestureAnimation.cpp b/Source/core/platform/chromium/support/WebActiveGestureAnimation.cpp
index c7cad05..cfc2fb7 100644
--- a/Source/core/platform/chromium/support/WebActiveGestureAnimation.cpp
+++ b/Source/core/platform/chromium/support/WebActiveGestureAnimation.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "WebActiveGestureAnimation.h"
+#include "core/platform/chromium/support/WebActiveGestureAnimation.h"
 
 #include <public/WebGestureCurve.h>
 #include <public/WebGestureCurveTarget.h>
diff --git a/Source/core/html/DOMFormData.idl b/Source/core/platform/chromium/support/WebCursorInfo.cpp
similarity index 72%
copy from Source/core/html/DOMFormData.idl
copy to Source/core/platform/chromium/support/WebCursorInfo.cpp
index 25d9ed1..0e7dfa5 100644
--- a/Source/core/html/DOMFormData.idl
+++ b/Source/core/platform/chromium/support/WebCursorInfo.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -28,15 +28,24 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    CustomConstructor(optional HTMLFormElement form),
-    InterfaceName=FormData,
-    ImplementationLacksVTable
-] interface DOMFormData {
-    // void append(DOMString name, DOMString value);
-    // void append(DOMString name, Blob value, optional DOMString filename);
-    [Custom] void append([Default=Undefined] optional DOMString name, 
-                         [Default=Undefined] optional DOMString value,
-                         [Default=Undefined] optional DOMString filename);
-};
+#include "config.h"
+#include "WebCursorInfo.h"
 
+#include "core/platform/Cursor.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebCursorInfo::WebCursorInfo(const Cursor& cursor)
+    : type(static_cast<Type>(cursor.type()))
+    , hotSpot(cursor.hotSpot())
+    , imageScaleFactor(cursor.imageScaleFactor())
+    , customImage(cursor.image())
+#ifdef WIN32
+    , externalHandle(0)
+#endif
+{
+}
+
+} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.cpp b/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.cpp
new file mode 100644
index 0000000..1428191
--- /dev/null
+++ b/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.cpp
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "core/platform/chromium/support/WebScrollbarThemeClientImpl.h"
+
+using WebKit::WebScrollbar;
+
+namespace WebCore {
+
+WebScrollbarThemeClientImpl::WebScrollbarThemeClientImpl(WebScrollbar* scrollbar)
+    : m_scrollbar(scrollbar)
+{
+}
+
+int WebScrollbarThemeClientImpl::x() const
+{
+    return location().x();
+}
+
+int WebScrollbarThemeClientImpl::y() const
+{
+    return location().y();
+}
+
+int WebScrollbarThemeClientImpl::width() const
+{
+    return size().width();
+}
+
+int WebScrollbarThemeClientImpl::height() const
+{
+    return size().height();
+}
+
+IntSize WebScrollbarThemeClientImpl::size() const
+{
+    return m_scrollbar->size();
+}
+
+IntPoint WebScrollbarThemeClientImpl::location() const
+{
+    return m_scrollbar->location();
+}
+
+ScrollView* WebScrollbarThemeClientImpl::parent() const
+{
+    // Unused by Chromium scrollbar themes.
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+ScrollView* WebScrollbarThemeClientImpl::root() const
+{
+    // Unused by Chromium scrollbar themes.
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+void WebScrollbarThemeClientImpl::setFrameRect(const IntRect&)
+{
+    // Unused by Chromium scrollbar themes.
+    ASSERT_NOT_REACHED();
+}
+
+IntRect WebScrollbarThemeClientImpl::frameRect() const
+{
+    return IntRect(location(), size());
+}
+
+void WebScrollbarThemeClientImpl::invalidate()
+{
+    // Unused by Chromium scrollbar themes.
+    ASSERT_NOT_REACHED();
+}
+
+void WebScrollbarThemeClientImpl::invalidateRect(const IntRect&)
+{
+    // Unused by Chromium scrollbar themes.
+    ASSERT_NOT_REACHED();
+}
+
+WebCore::ScrollbarOverlayStyle WebScrollbarThemeClientImpl::scrollbarOverlayStyle() const
+{
+    return static_cast<WebCore::ScrollbarOverlayStyle>(m_scrollbar->scrollbarOverlayStyle());
+}
+
+void WebScrollbarThemeClientImpl::getTickmarks(Vector<IntRect>& tickmarks) const
+{
+    WebKit::WebVector<WebKit::WebRect> webTickmarks;
+    m_scrollbar->getTickmarks(webTickmarks);
+    tickmarks.resize(webTickmarks.size());
+    for (size_t i = 0; i < webTickmarks.size(); ++i)
+        tickmarks[i] = webTickmarks[i];
+}
+
+bool WebScrollbarThemeClientImpl::isScrollableAreaActive() const
+{
+    return m_scrollbar->isScrollableAreaActive();
+}
+
+bool WebScrollbarThemeClientImpl::isScrollViewScrollbar() const
+{
+    // Unused by Chromium scrollbar themes.
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+IntPoint WebScrollbarThemeClientImpl::convertFromContainingWindow(const IntPoint& windowPoint)
+{
+    // Unused by Chromium scrollbar themes.
+    ASSERT_NOT_REACHED();
+    return windowPoint;
+}
+
+bool WebScrollbarThemeClientImpl::isCustomScrollbar() const
+{
+    return m_scrollbar->isCustomScrollbar();
+}
+
+WebCore::ScrollbarOrientation WebScrollbarThemeClientImpl::orientation() const
+{
+    return static_cast<WebCore::ScrollbarOrientation>(m_scrollbar->orientation());
+}
+
+int WebScrollbarThemeClientImpl::value() const
+{
+    return m_scrollbar->value();
+}
+
+float WebScrollbarThemeClientImpl::currentPos() const
+{
+    return value();
+}
+
+int WebScrollbarThemeClientImpl::visibleSize() const
+{
+    return totalSize() - maximum();
+}
+
+int WebScrollbarThemeClientImpl::totalSize() const
+{
+    return m_scrollbar->totalSize();
+}
+
+int WebScrollbarThemeClientImpl::maximum() const
+{
+    return m_scrollbar->maximum();
+}
+
+WebCore::ScrollbarControlSize WebScrollbarThemeClientImpl::controlSize() const
+{
+    return static_cast<WebCore::ScrollbarControlSize>(m_scrollbar->controlSize());
+}
+
+int WebScrollbarThemeClientImpl::lineStep() const
+{
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+int WebScrollbarThemeClientImpl::pageStep() const
+{
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+WebCore::ScrollbarPart WebScrollbarThemeClientImpl::pressedPart() const
+{
+    return static_cast<WebCore::ScrollbarPart>(m_scrollbar->pressedPart());
+}
+
+WebCore::ScrollbarPart WebScrollbarThemeClientImpl::hoveredPart() const
+{
+    return static_cast<WebCore::ScrollbarPart>(m_scrollbar->hoveredPart());
+}
+
+void WebScrollbarThemeClientImpl::styleChanged()
+{
+    ASSERT_NOT_REACHED();
+}
+
+bool WebScrollbarThemeClientImpl::enabled() const
+{
+    return m_scrollbar->enabled();
+}
+
+void WebScrollbarThemeClientImpl::setEnabled(bool)
+{
+    ASSERT_NOT_REACHED();
+}
+
+bool WebScrollbarThemeClientImpl::isOverlayScrollbar() const
+{
+    return m_scrollbar->isOverlay();
+}
+
+bool WebScrollbarThemeClientImpl::isAlphaLocked() const
+{
+    return m_scrollbar->isAlphaLocked();
+}
+
+void WebScrollbarThemeClientImpl::setIsAlphaLocked(bool flag)
+{
+    m_scrollbar->setIsAlphaLocked(flag);
+}
+
+} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.h b/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.h
new file mode 100644
index 0000000..ab42c89
--- /dev/null
+++ b/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebScrollbarThemeClientImpl_h
+#define WebScrollbarThemeClientImpl_h
+
+#include "core/platform/ScrollbarThemeClient.h"
+#include "wtf/Noncopyable.h"
+#include <public/WebScrollbar.h>
+
+namespace WebCore {
+class ScrollView;
+
+// Adapts a WebScrollbar to the ScrollbarThemeClient interface
+class WebScrollbarThemeClientImpl : public ScrollbarThemeClient {
+    WTF_MAKE_NONCOPYABLE(WebScrollbarThemeClientImpl);
+public:
+    // Caller must retain ownership of this pointer and ensure that its lifetime
+    // exceeds this instance.
+    WebScrollbarThemeClientImpl(WebKit::WebScrollbar*);
+
+    // Implement ScrollbarThemeClient interface
+    virtual int x() const OVERRIDE;
+    virtual int y() const OVERRIDE;
+    virtual int width() const OVERRIDE;
+    virtual int height() const OVERRIDE;
+    virtual IntSize size() const OVERRIDE;
+    virtual IntPoint location() const OVERRIDE;
+    virtual ScrollView* parent() const OVERRIDE;
+    virtual ScrollView* root() const OVERRIDE;
+    virtual void setFrameRect(const IntRect&) OVERRIDE;
+    virtual IntRect frameRect() const OVERRIDE;
+    virtual void invalidate() OVERRIDE;
+    virtual void invalidateRect(const IntRect&) OVERRIDE;
+    virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE;
+    virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE;
+    virtual bool isScrollableAreaActive() const OVERRIDE;
+    virtual bool isScrollViewScrollbar() const OVERRIDE;
+    virtual IntPoint convertFromContainingWindow(const IntPoint&) OVERRIDE;
+    virtual bool isCustomScrollbar() const OVERRIDE;
+    virtual ScrollbarOrientation orientation() const OVERRIDE;
+    virtual int value() const OVERRIDE;
+    virtual float currentPos() const OVERRIDE;
+    virtual int visibleSize() const OVERRIDE;
+    virtual int totalSize() const OVERRIDE;
+    virtual int maximum() const OVERRIDE;
+    virtual ScrollbarControlSize controlSize() const OVERRIDE;
+    virtual int lineStep() const OVERRIDE;
+    virtual int pageStep() const OVERRIDE;
+    virtual ScrollbarPart pressedPart() const OVERRIDE;
+    virtual ScrollbarPart hoveredPart() const OVERRIDE;
+    virtual void styleChanged() OVERRIDE;
+    virtual bool enabled() const OVERRIDE;
+    virtual void setEnabled(bool) OVERRIDE;
+    virtual bool isOverlayScrollbar() const OVERRIDE;
+    virtual bool isAlphaLocked() const OVERRIDE;
+    virtual void setIsAlphaLocked(bool) OVERRIDE;
+
+private:
+    WebKit::WebScrollbar* m_scrollbar;
+};
+
+}
+
+#endif // WebScrollbarThemeClientImpl_h
diff --git a/Source/core/platform/chromium/support/WebScrollbarThemeGeometryNative.cpp b/Source/core/platform/chromium/support/WebScrollbarThemeGeometryNative.cpp
index 3d7a089..14aa38b 100644
--- a/Source/core/platform/chromium/support/WebScrollbarThemeGeometryNative.cpp
+++ b/Source/core/platform/chromium/support/WebScrollbarThemeGeometryNative.cpp
@@ -27,8 +27,8 @@
 
 #include "core/platform/chromium/support/WebScrollbarThemeGeometryNative.h"
 
-#include "WebScrollbarThemeClientImpl.h"
 #include "core/platform/ScrollbarThemeComposite.h"
+#include "core/platform/chromium/support/WebScrollbarThemeClientImpl.h"
 #include <public/WebScrollbar.h>
 
 using namespace WebCore;
diff --git a/Source/core/platform/graphics/GraphicsContext.cpp b/Source/core/platform/graphics/GraphicsContext.cpp
index b0d0653..41e6f83 100644
--- a/Source/core/platform/graphics/GraphicsContext.cpp
+++ b/Source/core/platform/graphics/GraphicsContext.cpp
@@ -34,7 +34,6 @@
 #include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/RoundedRect.h"
 #include "core/platform/graphics/TextRunIterator.h"
-#include "core/platform/graphics/skia/PlatformContextSkiaState.h"
 #include "core/platform/graphics/skia/SkiaUtils.h"
 #include "core/platform/text/BidiResolver.h"
 
@@ -75,21 +74,21 @@
     , m_isCertainlyOpaque(true)
     , m_printing(false)
 {
-    if (!canvas)
-        setPaintingDisabled(true);
-
-    m_stateStack.append(PlatformContextSkiaState());
-    m_skiaState = &m_stateStack.last();
+    m_stateStack.append(adoptPtr(new GraphicsContextState()));
+    m_state = m_stateStack.last().get();
 }
 
 GraphicsContext::~GraphicsContext()
 {
-    ASSERT(m_stack.isEmpty());
+    ASSERT(m_stateStack.size() == 1);
     ASSERT(!m_transparencyCount);
 }
 
 SkDevice* GraphicsContext::createCompatibleDevice(const IntSize& size, bool hasAlpha) const
 {
+    if (paintingDisabled())
+        return 0;
+
     return m_canvas->createCompatibleDevice(SkBitmap::kARGB_8888_Config, size.width(), size.height(), !hasAlpha);
 }
 
@@ -98,14 +97,8 @@
     if (paintingDisabled())
         return;
 
-    m_stack.append(m_state);
-
-    m_stateStack.append(m_skiaState->cloneInheritedProperties());
-    m_skiaState = &m_stateStack.last();
-
-    // The clip image only needs to be applied once. Reset the image so that we
-    // don't attempt to clip multiple times.
-    m_skiaState->m_imageBufferClip.reset();
+    m_stateStack.append(m_state->clone());
+    m_state = m_stateStack.last().get();
 
     m_saveStateStack.append(DeferredSaveState(m_deferredSaveFlags, m_canvas->getSaveCount()));
     m_deferredSaveFlags |= SkCanvas::kMatrixClip_SaveFlag;
@@ -116,20 +109,18 @@
     if (paintingDisabled())
         return;
 
-    if (m_stack.isEmpty()) {
+    if (m_stateStack.size() == 1) {
         LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty");
         return;
     }
-    m_state = m_stack.last();
-    m_stack.removeLast();
 
-    if (!m_skiaState->m_imageBufferClip.empty()) {
-        applyClipFromImage(m_skiaState->m_clip, m_skiaState->m_imageBufferClip);
+    if (!m_state->m_imageBufferClip.empty()) {
+        applyClipFromImage(m_state->m_clip, m_state->m_imageBufferClip);
         m_canvas->restore();
     }
 
     m_stateStack.removeLast();
-    m_skiaState = &m_stateStack.last();
+    m_state = m_stateStack.last().get();
 
     DeferredSaveState savedState = m_saveStateStack.last();
     m_saveStateStack.removeLast();
@@ -139,6 +130,9 @@
 
 void GraphicsContext::saveLayer(const SkRect* bounds, const SkPaint* paint, SkCanvas::SaveFlags saveFlags)
 {
+    if (paintingDisabled())
+        return;
+
     realizeSave(SkCanvas::kMatrixClip_SaveFlag);
 
     m_canvas->saveLayer(bounds, paint, saveFlags);
@@ -150,6 +144,9 @@
 
 void GraphicsContext::restoreLayer()
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->restore();
     if (m_trackOpaqueRegion)
         m_opaqueRegion.popCanvasLayer(this);
@@ -157,46 +154,42 @@
 
 void GraphicsContext::setStrokeThickness(float thickness)
 {
-    m_state.strokeThickness = thickness;
-
     if (paintingDisabled())
         return;
-    m_skiaState->m_strokeThickness = thickness;
+
+    m_state->m_strokeThickness = thickness;
 }
 
 void GraphicsContext::setStrokeStyle(StrokeStyle style)
 {
-    m_state.strokeStyle = style;
-
     if (paintingDisabled())
         return;
 
-    m_skiaState->m_strokeStyle = style;
+    m_state->m_strokeStyle = style;
 }
 
 void GraphicsContext::setStrokeColor(const Color& color, ColorSpace colorSpace)
 {
-    m_state.strokeColor = color;
-    m_state.strokeColorSpace = colorSpace;
-    m_state.strokeGradient.clear();
-    m_state.strokePattern.clear();
-
     if (paintingDisabled())
         return;
 
-    m_skiaState->m_strokeColor = color.rgb();
+    m_state->m_strokeColor = color;
+    m_state->m_strokeColorPacked = color.rgb();
+    m_state->m_strokeColorSpace = colorSpace;
+    m_state->m_strokeGradient.clear();
+    m_state->m_strokePattern.clear();
 }
 
 void GraphicsContext::setShadow(const FloatSize& size, float blur, const Color& color, ColorSpace colorSpace)
 {
-    m_state.shadowOffset = size;
-    m_state.shadowBlur = blur;
-    m_state.shadowColor = color;
-    m_state.shadowColorSpace = colorSpace;
-
     if (paintingDisabled())
         return;
 
+    m_state->m_shadowOffset = size;
+    m_state->m_shadowBlur = blur;
+    m_state->m_shadowColor = color;
+    m_state->m_shadowColorSpace = colorSpace;
+
     // Detect when there's no effective shadow and clear the looper.
     if (!size.width() && !size.height() && !blur) {
         setDrawLooper(0);
@@ -208,20 +201,9 @@
 
     uint32_t mfFlags = SkBlurMaskFilter::kHighQuality_BlurFlag;
 
-    if (m_state.shadowsIgnoreTransforms)  {
-        // Currently only the GraphicsContext associated with the
-        // CanvasRenderingContext for HTMLCanvasElement have shadows ignore
-        // Transforms. So with this flag set, we know this state is associated
-        // with a CanvasRenderingContext.
+    if (m_state->m_shadowsIgnoreTransforms)
         mfFlags |= SkBlurMaskFilter::kIgnoreTransform_BlurFlag;
 
-        // CG uses natural orientation for Y axis, but the HTML5 canvas spec
-        // does not.
-        // So we now flip the height since it was flipped in
-        // CanvasRenderingContext in order to work with CG.
-        height = -height;
-    }
-
     SkColor c;
     if (color.isValid())
         c = color.rgb();
@@ -248,7 +230,7 @@
     info.fPaintBits |= SkLayerDrawLooper::kMaskFilter_Bit; // our blur
     info.fPaintBits |= SkLayerDrawLooper::kColorFilter_Bit;
     info.fOffset.set(width, height);
-    info.fPostTranslate = m_state.shadowsIgnoreTransforms;
+    info.fPostTranslate = m_state->m_shadowsIgnoreTransforms;
 
     SkMaskFilter* mf = SkBlurMaskFilter::Create((double)blur / 2.0, SkBlurMaskFilter::kNormal_BlurStyle, mfFlags);
 
@@ -262,120 +244,103 @@
     setDrawLooper(dl);
 }
 
-void GraphicsContext::setLegacyShadow(const FloatSize& offset, float blur, const Color& color, ColorSpace colorSpace)
-{
-    setShadow(offset, blur, color, colorSpace);
-}
-
 void GraphicsContext::clearShadow()
 {
-    m_state.shadowOffset = FloatSize();
-    m_state.shadowBlur = 0;
-    m_state.shadowColor = Color();
-    m_state.shadowColorSpace = ColorSpaceDeviceRGB;
-
     if (paintingDisabled())
         return;
+
+    m_state->m_shadowOffset = FloatSize();
+    m_state->m_shadowBlur = 0;
+    m_state->m_shadowColor = Color();
+    m_state->m_shadowColorSpace = ColorSpaceDeviceRGB;
+
     setDrawLooper(0);
 }
 
 bool GraphicsContext::hasShadow() const
 {
-    return m_state.shadowColor.isValid() && m_state.shadowColor.alpha()
-           && (m_state.shadowBlur || m_state.shadowOffset.width() || m_state.shadowOffset.height());
+    return m_state->m_shadowColor.isValid() && m_state->m_shadowColor.alpha()
+        && (m_state->m_shadowBlur || m_state->m_shadowOffset.width() || m_state->m_shadowOffset.height());
 }
 
 bool GraphicsContext::getShadow(FloatSize& offset, float& blur, Color& color, ColorSpace& colorSpace) const
 {
-    offset = m_state.shadowOffset;
-    blur = m_state.shadowBlur;
-    color = m_state.shadowColor;
-    colorSpace = m_state.shadowColorSpace;
+    offset = m_state->m_shadowOffset;
+    blur = m_state->m_shadowBlur;
+    color = m_state->m_shadowColor;
+    colorSpace = m_state->m_shadowColorSpace;
 
     return hasShadow();
 }
 
 float GraphicsContext::strokeThickness() const
 {
-    return m_state.strokeThickness;
+    return m_state->m_strokeThickness;
 }
 
 StrokeStyle GraphicsContext::strokeStyle() const
 {
-    return m_state.strokeStyle;
+    return m_state->m_strokeStyle;
 }
 
 Color GraphicsContext::strokeColor() const
 {
-    return m_state.strokeColor;
+    return m_state->m_strokeColor;
 }
 
 ColorSpace GraphicsContext::strokeColorSpace() const
 {
-    return m_state.strokeColorSpace;
+    return m_state->m_strokeColorSpace;
 }
 
 WindRule GraphicsContext::fillRule() const
 {
-    return m_state.fillRule;
+    return m_state->m_fillRule;
 }
 
 void GraphicsContext::setFillRule(WindRule fillRule)
 {
-    m_state.fillRule = fillRule;
+    if (paintingDisabled())
+        return;
+
+    m_state->m_fillRule = fillRule;
 }
 
 void GraphicsContext::setFillColor(const Color& color, ColorSpace colorSpace)
 {
-    m_state.fillColor = color;
-    m_state.fillColorSpace = colorSpace;
-    m_state.fillGradient.clear();
-    m_state.fillPattern.clear();
-
     if (paintingDisabled())
         return;
 
-    m_skiaState->m_fillColor = color.rgb();
+    m_state->m_fillColor = color;
+    m_state->m_fillColorPacked = color.rgb();
+    m_state->m_fillColorSpace = colorSpace;
+    m_state->m_fillGradient.clear();
+    m_state->m_fillPattern.clear();
 }
 
 Color GraphicsContext::fillColor() const
 {
-    return m_state.fillColor;
+    return m_state->m_fillColor;
 }
 
 ColorSpace GraphicsContext::fillColorSpace() const
 {
-    return m_state.fillColorSpace;
+    return m_state->m_fillColorSpace;
 }
 
 SkDrawLooper* GraphicsContext::drawLooper() const
 {
-    return m_skiaState->m_looper;
-}
-
-StrokeStyle GraphicsContext::strokeStyleSkia() const
-{
-    return m_skiaState->m_strokeStyle;
-}
-
-float GraphicsContext::strokeThicknessSkia() const
-{
-    return m_skiaState->m_strokeThickness;
-}
-
-TextDrawingModeFlags GraphicsContext::textDrawingModeSkia() const
-{
-    return m_skiaState->m_textDrawingMode;
+    return m_state->m_looper;
 }
 
 SkColor GraphicsContext::effectiveFillColor() const
 {
-    return m_skiaState->applyAlpha(m_skiaState->m_fillColor);
+    return m_state->applyAlpha(m_state->m_fillColorPacked);
 }
 
 int GraphicsContext::getNormalizedAlpha() const
 {
-    int alpha = roundf(m_skiaState->m_alpha * 256);
+    int alpha = roundf(m_state->m_alpha * 256);
     if (alpha > 255)
         alpha = 255;
     else if (alpha < 0)
@@ -385,41 +350,61 @@
 
 void GraphicsContext::setShouldAntialias(bool b)
 {
-    m_state.shouldAntialias = b;
-
     if (paintingDisabled())
         return;
 
-    m_skiaState->m_useAntialiasing = b;
+    m_state->m_shouldAntialias = b;
 }
 
 bool GraphicsContext::shouldAntialias() const
 {
-    return m_state.shouldAntialias;
+    return m_state->m_shouldAntialias;
 }
 
 void GraphicsContext::setShouldSmoothFonts(bool b)
 {
-    m_state.shouldSmoothFonts = b;
+    if (paintingDisabled())
+        return;
+
+    m_state->m_shouldSmoothFonts = b;
 }
 
 bool GraphicsContext::shouldSmoothFonts() const
 {
-    return m_state.shouldSmoothFonts;
+    return m_state->m_shouldSmoothFonts;
 }
 
 void GraphicsContext::setShouldSubpixelQuantizeFonts(bool b)
 {
-    m_state.shouldSubpixelQuantizeFonts = b;
+    if (paintingDisabled())
+        return;
+
+    m_state->m_shouldSubpixelQuantizeFonts = b;
 }
 
 bool GraphicsContext::shouldSubpixelQuantizeFonts() const
 {
-    return m_state.shouldSubpixelQuantizeFonts;
+    return m_state->m_shouldSubpixelQuantizeFonts;
+}
+
+void GraphicsContext::setShadowsIgnoreTransforms(bool ignoreTransforms)
+{
+    if (paintingDisabled())
+        return;
+
+    m_state->m_shadowsIgnoreTransforms = ignoreTransforms;
+}
+
+bool GraphicsContext::shadowsIgnoreTransforms() const
+{
+    return m_state->m_shadowsIgnoreTransforms;
 }
 
 void GraphicsContext::adjustTextRenderMode(SkPaint* paint)
 {
+    if (paintingDisabled())
+        return;
+
     if (!paint->isLCDRenderText())
         return;
 
@@ -440,91 +425,94 @@
 
 void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern)
 {
+    if (paintingDisabled())
+        return;
+
     ASSERT(pattern);
     if (!pattern) {
         setStrokeColor(Color::black, ColorSpaceDeviceRGB);
         return;
     }
-    m_state.strokeGradient.clear();
-    m_state.strokePattern = pattern;
+    m_state->m_strokeGradient.clear();
+    m_state->m_strokePattern = pattern;
 }
 
 void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern)
 {
+    if (paintingDisabled())
+        return;
+
     ASSERT(pattern);
     if (!pattern) {
         setFillColor(Color::black, ColorSpaceDeviceRGB);
         return;
     }
-    m_state.fillGradient.clear();
-    m_state.fillPattern = pattern;
+    m_state->m_fillGradient.clear();
+    m_state->m_fillPattern = pattern;
 }
 
 void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient)
 {
+    if (paintingDisabled())
+        return;
+
     ASSERT(gradient);
     if (!gradient) {
         setStrokeColor(Color::black, ColorSpaceDeviceRGB);
         return;
     }
-    m_state.strokeGradient = gradient;
-    m_state.strokePattern.clear();
+    m_state->m_strokeGradient = gradient;
+    m_state->m_strokePattern.clear();
 }
 
 void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient)
 {
+    if (paintingDisabled())
+        return;
+
     ASSERT(gradient);
     if (!gradient) {
         setFillColor(Color::black, ColorSpaceDeviceRGB);
         return;
     }
-    m_state.fillGradient = gradient;
-    m_state.fillPattern.clear();
+    m_state->m_fillGradient = gradient;
+    m_state->m_fillPattern.clear();
 }
 
 Gradient* GraphicsContext::fillGradient() const
 {
-    return m_state.fillGradient.get();
+    return m_state->m_fillGradient.get();
 }
 
 Gradient* GraphicsContext::strokeGradient() const
 {
-    return m_state.strokeGradient.get();
+    return m_state->m_strokeGradient.get();
 }
 
 Pattern* GraphicsContext::fillPattern() const
 {
-    return m_state.fillPattern.get();
+    return m_state->m_fillPattern.get();
 }
 
 Pattern* GraphicsContext::strokePattern() const
 {
-    return m_state.strokePattern.get();
-}
-
-void GraphicsContext::setShadowsIgnoreTransforms(bool ignoreTransforms)
-{
-    m_state.shadowsIgnoreTransforms = ignoreTransforms;
-}
-
-bool GraphicsContext::shadowsIgnoreTransforms() const
-{
-    return m_state.shadowsIgnoreTransforms;
+    return m_state->m_strokePattern.get();
 }
 
 void GraphicsContext::setLineCap(LineCap cap)
 {
     if (paintingDisabled())
         return;
+
     switch (cap) {
     case ButtCap:
-        m_skiaState->m_lineCap = SkPaint::kButt_Cap;
+        m_state->m_lineCap = SkPaint::kButt_Cap;
         break;
     case RoundCap:
-        m_skiaState->m_lineCap = SkPaint::kRound_Cap;
+        m_state->m_lineCap = SkPaint::kRound_Cap;
         break;
     case SquareCap:
-        m_skiaState->m_lineCap = SkPaint::kSquare_Cap;
+        m_state->m_lineCap = SkPaint::kSquare_Cap;
         break;
     default:
         ASSERT(0);
@@ -543,7 +531,7 @@
     if (!dashLength) {
         // If no dash is set, revert to solid stroke
         // FIXME: do we need to set NoStroke in some cases?
-        m_skiaState->m_strokeStyle = SolidStroke;
+        m_state->m_strokeStyle = SolidStroke;
         setDashPathEffect(0);
         return;
     }
@@ -563,15 +551,16 @@
 {
     if (paintingDisabled())
         return;
+
     switch (join) {
     case MiterJoin:
-        m_skiaState->m_lineJoin = SkPaint::kMiter_Join;
+        m_state->m_lineJoin = SkPaint::kMiter_Join;
         break;
     case RoundJoin:
-        m_skiaState->m_lineJoin = SkPaint::kRound_Join;
+        m_state->m_lineJoin = SkPaint::kRound_Join;
         break;
     case BevelJoin:
-        m_skiaState->m_lineJoin = SkPaint::kBevel_Join;
+        m_state->m_lineJoin = SkPaint::kBevel_Join;
         break;
     default:
         ASSERT(0);
@@ -583,7 +572,8 @@
 {
     if (paintingDisabled())
         return;
-    m_skiaState->m_miterLimit = limit;
+
+    m_state->m_miterLimit = limit;
 }
 
 void GraphicsContext::setAlpha(float alpha)
@@ -591,7 +581,87 @@
     if (paintingDisabled())
         return;
 
-    m_skiaState->m_alpha = alpha;
+    m_state->m_alpha = alpha;
+}
+
+TextDrawingModeFlags GraphicsContext::textDrawingMode() const
+{
+    return m_state->m_textDrawingMode;
+}
+
+void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode)
+{
+    if (paintingDisabled())
+        return;
+
+    m_state->m_textDrawingMode = mode;
+}
+
+bool GraphicsContext::updatingControlTints() const
+{
+    return m_updatingControlTints;
+}
+
+void GraphicsContext::setUpdatingControlTints(bool b)
+{
+    m_updatingControlTints = b;
+}
+
+InterpolationQuality GraphicsContext::imageInterpolationQuality() const
+{
+    return m_state->m_interpolationQuality;
+}
+
+void GraphicsContext::setImageInterpolationQuality(InterpolationQuality q)
+{
+    if (paintingDisabled())
+        return;
+
+    m_state->m_interpolationQuality = q;
+}
+
+void GraphicsContext::setDrawLooper(SkDrawLooper* dl)
+{
+    if (paintingDisabled())
+        return;
+
+    SkRefCnt_SafeAssign(m_state->m_looper, dl);
+}
+
+void GraphicsContext::setDashPathEffect(SkDashPathEffect* dash)
+{
+    if (paintingDisabled())
+        return;
+
+    if (dash != m_state->m_dash) {
+        SkSafeUnref(m_state->m_dash);
+        m_state->m_dash = dash;
+    }
+}
+
+void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation, BlendMode blendMode)
+{
+    if (paintingDisabled())
+        return;
+
+    m_state->m_compositeOperator = compositeOperation;
+    m_state->m_blendMode = blendMode;
+    m_state->m_xferMode = WebCoreCompositeToSkiaComposite(compositeOperation, blendMode);
+}
+
+CompositeOperator GraphicsContext::compositeOperation() const
+{
+    return m_state->m_compositeOperator;
+}
+
+BlendMode GraphicsContext::blendModeOperation() const
+{
+    return m_state->m_blendMode;
+}
+
+SkColor GraphicsContext::effectiveStrokeColor() const
+{
+    return m_state->applyAlpha(m_state->m_strokeColorPacked);
 }
 
 void GraphicsContext::beginTransparencyLayer(float opacity)
@@ -607,7 +677,7 @@
 
     SkPaint layerPaint;
     layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255));
-    layerPaint.setXfermodeMode(m_skiaState->m_xferMode);
+    layerPaint.setXfermodeMode(m_state->m_xferMode);
 
     saveLayer(0, &layerPaint, saveFlags);
 
@@ -631,6 +701,9 @@
 
 void GraphicsContext::beginLayerClippedToImage(const FloatRect& rect, const ImageBuffer* imageBuffer)
 {
+    if (paintingDisabled())
+        return;
+
     SkRect bounds = WebCoreFloatRectToSKRect(rect);
 
     if (imageBuffer->internalSize().isEmpty()) {
@@ -641,11 +714,11 @@
     // Skia doesn't support clipping to an image, so we create a layer. The next
     // time restore is invoked the layer and |imageBuffer| are combined to
     // create the resulting image.
-    m_skiaState->m_clip = bounds;
+    m_state->m_clip = bounds;
 
     // Get the absolute coordinates of the stored clipping rectangle to make it
     // independent of any transform changes.
-    getTotalMatrix().mapRect(&m_skiaState->m_clip);
+    getTotalMatrix().mapRect(&m_state->m_clip);
 
     SkCanvas::SaveFlags saveFlags = static_cast<SkCanvas::SaveFlags>(SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag);
     saveLayer(&bounds, 0, saveFlags);
@@ -653,94 +726,51 @@
     const SkBitmap* bitmap = imageBuffer->context()->bitmap();
 
     if (m_trackOpaqueRegion) {
-        SkRect opaqueRect = bitmap->isOpaque() ? m_skiaState->m_clip : SkRect::MakeEmpty();
+        SkRect opaqueRect = bitmap->isOpaque() ? m_state->m_clip : SkRect::MakeEmpty();
         m_opaqueRegion.setImageMask(opaqueRect);
     }
 
     // Copy off the image as |imageBuffer| may be deleted before restore is invoked.
     if (bitmap->isImmutable())
-        m_skiaState->m_imageBufferClip = *bitmap;
+        m_state->m_imageBufferClip = *bitmap;
     else {
         // We need to make a deep-copy of the pixels themselves, so they don't
         // change on us between now and when we want to apply them in restore()
-        bitmap->copyTo(&m_skiaState->m_imageBufferClip, SkBitmap::kARGB_8888_Config);
+        bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config);
     }
 }
 
-bool GraphicsContext::updatingControlTints() const
-{
-    return m_updatingControlTints;
-}
-
-void GraphicsContext::setUpdatingControlTints(bool b)
-{
-    setPaintingDisabled(b);
-    m_updatingControlTints = b;
-}
-
-void GraphicsContext::setPaintingDisabled(bool f)
-{
-    m_state.paintingDisabled = f;
-}
-
-bool GraphicsContext::paintingDisabled() const
-{
-    return m_state.paintingDisabled;
-}
-
-InterpolationQuality GraphicsContext::imageInterpolationQuality() const
-{
-    return m_skiaState->m_interpolationQuality;
-}
-
-void GraphicsContext::setImageInterpolationQuality(InterpolationQuality q)
-{
-    m_skiaState->m_interpolationQuality = q;
-}
-
-void GraphicsContext::setDrawLooper(SkDrawLooper* dl)
-{
-    SkRefCnt_SafeAssign(m_skiaState->m_looper, dl);
-}
-
-void GraphicsContext::setDashPathEffect(SkDashPathEffect* dash)
-{
-    if (dash != m_skiaState->m_dash) {
-        SkSafeUnref(m_skiaState->m_dash);
-        m_skiaState->m_dash = dash;
-    }
-}
-
-SkColor GraphicsContext::effectiveStrokeColor() const
-{
-    return m_skiaState->applyAlpha(m_skiaState->m_strokeColor);
-}
-
 void GraphicsContext::setupPaintForFilling(SkPaint* paint) const
 {
+    if (paintingDisabled())
+        return;
+
     setupPaintCommon(paint);
 
-    setupShader(paint, m_state.fillGradient.get(), m_state.fillPattern.get(), m_skiaState->m_fillColor);
+    setupShader(paint, m_state->m_fillGradient.get(), m_state->m_fillPattern.get(), m_state->m_fillColorPacked);
 }
 
 float GraphicsContext::setupPaintForStroking(SkPaint* paint, SkRect* rect, int length) const
 {
+    if (paintingDisabled())
+        return 0.0f;
+
     setupPaintCommon(paint);
 
-    setupShader(paint, m_state.strokeGradient.get(), m_state.strokePattern.get(), m_skiaState->m_strokeColor);
+    setupShader(paint, m_state->m_strokeGradient.get(), m_state->m_strokePattern.get(), m_state->m_strokeColorPacked);
 
-    float width = m_skiaState->m_strokeThickness;
+    float width = m_state->m_strokeThickness;
 
     paint->setStyle(SkPaint::kStroke_Style);
     paint->setStrokeWidth(SkFloatToScalar(width));
-    paint->setStrokeCap(m_skiaState->m_lineCap);
-    paint->setStrokeJoin(m_skiaState->m_lineJoin);
-    paint->setStrokeMiter(SkFloatToScalar(m_skiaState->m_miterLimit));
+    paint->setStrokeCap(m_state->m_lineCap);
+    paint->setStrokeJoin(m_state->m_lineJoin);
+    paint->setStrokeMiter(SkFloatToScalar(m_state->m_miterLimit));
 
-    if (m_skiaState->m_dash)
-        paint->setPathEffect(m_skiaState->m_dash);
+    if (m_state->m_dash)
+        paint->setPathEffect(m_state->m_dash);
     else {
-        switch (m_skiaState->m_strokeStyle) {
+        switch (m_state->m_strokeStyle) {
         case NoStroke:
         case SolidStroke:
 #if ENABLE(CSS3_TEXT)
@@ -749,13 +779,13 @@
 #endif // CSS3_TEXT
             break;
         case DashedStroke:
-            width = m_skiaState->m_dashRatio * width;
+            width = m_state->m_dashRatio * width;
             // Fall through.
         case DottedStroke:
             // Truncate the width, since we don't want fuzzy dots or dashes.
             int dashLength = static_cast<int>(width);
             // Subtract off the endcaps, since they're rendered separately.
-            int distance = length - 2 * static_cast<int>(m_skiaState->m_strokeThickness);
+            int distance = length - 2 * static_cast<int>(m_state->m_strokeThickness);
             int phase = 1;
             if (dashLength > 1) {
                 // Determine how many dashes or dots we should have.
@@ -1075,14 +1105,13 @@
 
     SkRect skRect = rect;
     SkPaint paint;
-    int fillcolorNotTransparent = m_skiaState->m_fillColor & 0xFF000000;
+    int fillcolorNotTransparent = m_state->m_fillColorPacked & 0xFF000000;
     if (fillcolorNotTransparent) {
         setupPaintForFilling(&paint);
         drawRect(skRect, paint);
     }
 
-    if (m_skiaState->m_strokeStyle != NoStroke
-        && (m_skiaState->m_strokeColor & 0xFF000000)) {
+    if (m_state->m_strokeStyle != NoStroke && (m_state->m_strokeColorPacked & 0xFF000000)) {
         // We do a fill of four rects to simulate the stroke of a border.
         paint.reset();
         setupPaintForFilling(&paint);
@@ -1289,6 +1318,9 @@
 
 void GraphicsContext::writePixels(const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888 config8888)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->writePixels(bitmap, x, y, config8888);
 
     if (m_trackOpaqueRegion) {
@@ -1300,9 +1332,11 @@
     }
 }
 
-void GraphicsContext::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
-    const SkPaint* paint)
+void GraphicsContext::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->drawBitmap(bitmap, left, top, paint);
 
     if (m_trackOpaqueRegion) {
@@ -1314,6 +1348,9 @@
 void GraphicsContext::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc,
     const SkRect& dst, const SkPaint* paint)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->drawBitmapRect(bitmap, isrc, dst, paint);
 
     if (m_trackOpaqueRegion)
@@ -1322,6 +1359,9 @@
 
 void GraphicsContext::drawOval(const SkRect& oval, const SkPaint& paint)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->drawOval(oval, paint);
 
     if (m_trackOpaqueRegion)
@@ -1330,6 +1370,9 @@
 
 void GraphicsContext::drawPath(const SkPath& path, const SkPaint& paint)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->drawPath(path, paint);
 
     if (m_trackOpaqueRegion)
@@ -1338,6 +1381,9 @@
 
 void GraphicsContext::drawRect(const SkRect& rect, const SkPaint& paint)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->drawRect(rect, paint);
 
     if (m_trackOpaqueRegion)
@@ -1353,6 +1399,9 @@
 void GraphicsContext::drawPosText(const void* text, size_t byteLength,
     const SkPoint pos[], const SkPaint& paint)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->drawPosText(text, byteLength, pos, paint);
 
     // FIXME: compute bounds for positioned text.
@@ -1363,6 +1412,9 @@
 void GraphicsContext::drawPosTextH(const void* text, size_t byteLength,
     const SkScalar xpos[], SkScalar constY, const SkPaint& paint)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->drawPosTextH(text, byteLength, xpos, constY, paint);
 
     // FIXME: compute bounds for positioned text.
@@ -1373,6 +1425,9 @@
 void GraphicsContext::drawTextOnPath(const void* text, size_t byteLength,
     const SkPath& path, const SkMatrix* matrix, const SkPaint& paint)
 {
+    if (paintingDisabled())
+        return;
+
     m_canvas->drawTextOnPath(text, byteLength, path, matrix, paint);
 
     // FIXME: compute bounds for positioned text.
@@ -1389,7 +1444,7 @@
     SkPath& path = const_cast<SkPath&>(pathToFill.skPath());
     SkPath::FillType previousFillType = path.getFillType();
 
-    SkPath::FillType temporaryFillType = m_state.fillRule == RULE_EVENODD ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType;
+    SkPath::FillType temporaryFillType = m_state->m_fillRule == RULE_EVENODD ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType;
     path.setFillType(temporaryFillType);
 
     SkPaint paint;
@@ -1423,13 +1478,8 @@
     drawRect(r, paint);
 }
 
-void GraphicsContext::fillRoundedRect(const IntRect& rect,
-                                      const IntSize& topLeft,
-                                      const IntSize& topRight,
-                                      const IntSize& bottomLeft,
-                                      const IntSize& bottomRight,
-                                      const Color& color,
-                                      ColorSpace colorSpace)
+void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
+    const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace)
 {
     if (paintingDisabled())
         return;
@@ -1731,20 +1781,6 @@
                            SkScalarToDouble(m.getTranslateY()));
 }
 
-TextDrawingModeFlags GraphicsContext::textDrawingMode() const
-{
-    return m_state.textDrawingMode;
-}
-
-void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode)
-{
-    m_state.textDrawingMode = mode;
-    if (paintingDisabled())
-        return;
-
-    m_skiaState->m_textDrawingMode = mode;
-}
-
 void GraphicsContext::fillRect(const FloatRect& rect, Generator& generator)
 {
     if (paintingDisabled())
@@ -1809,27 +1845,6 @@
     drawRect(r, paint);
 }
 
-void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation, BlendMode blendMode)
-{
-    m_state.compositeOperator = compositeOperation;
-    m_state.blendMode = blendMode;
-
-    if (paintingDisabled())
-        return;
-
-    m_skiaState->m_xferMode = WebCoreCompositeToSkiaComposite(compositeOperation, blendMode);
-}
-
-CompositeOperator GraphicsContext::compositeOperation() const
-{
-    return m_state.compositeOperator;
-}
-
-BlendMode GraphicsContext::blendModeOperation() const
-{
-    return m_state.blendMode;
-}
-
 void GraphicsContext::adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, StrokeStyle penStyle)
 {
     // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic
@@ -1955,9 +1970,9 @@
     }
 #endif
 
-    paint->setAntiAlias(m_skiaState->m_useAntialiasing);
-    paint->setXfermodeMode(m_skiaState->m_xferMode);
-    paint->setLooper(m_skiaState->m_looper);
+    paint->setAntiAlias(m_state->m_shouldAntialias);
+    paint->setXfermodeMode(m_state->m_xferMode);
+    paint->setLooper(m_state->m_looper);
 }
 
 void GraphicsContext::drawOuterPath(const SkPath& path, SkPaint& paint, int width)
@@ -2105,13 +2120,16 @@
         paint->setFilterBitmap(imageInterpolationQuality() != InterpolationNone);
     }
 
-    paint->setColor(m_skiaState->applyAlpha(color));
+    paint->setColor(m_state->applyAlpha(color));
     paint->setShader(shader);
 }
 
 
 void GraphicsContext::applyClipFromImage(const SkRect& rect, const SkBitmap& imageBuffer)
 {
+    if (paintingDisabled())
+        return;
+
     // NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we
     // only look at the alpha when compositing. I'm not 100% sure this is what WebKit expects for image clipping.
     SkPaint paint;
diff --git a/Source/core/platform/graphics/GraphicsContext.h b/Source/core/platform/graphics/GraphicsContext.h
index 1b196bd..7502256 100644
--- a/Source/core/platform/graphics/GraphicsContext.h
+++ b/Source/core/platform/graphics/GraphicsContext.h
@@ -30,15 +30,11 @@
 
 #include "core/platform/chromium/TraceEvent.h"
 
-#include "core/platform/graphics/ColorSpace.h"
 #include "core/platform/graphics/DashArray.h"
 #include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/Font.h"
-#include "core/platform/graphics/Gradient.h"
-#include "core/platform/graphics/Image.h"
+#include "core/platform/graphics/GraphicsContextState.h"
 #include "core/platform/graphics/ImageOrientation.h"
-#include "core/platform/graphics/Path.h"
-#include "core/platform/graphics/Pattern.h"
 #include "core/platform/graphics/skia/OpaqueRegionSkia.h"
 
 #include "third_party/skia/include/core/SkBitmap.h"
@@ -48,111 +44,14 @@
 #include "third_party/skia/include/core/SkRect.h"
 #include "third_party/skia/include/core/SkRRect.h"
 #include "third_party/skia/include/effects/SkCornerPathEffect.h"
-#include "third_party/skia/include/effects/SkDashPathEffect.h"
 
 #include <wtf/Noncopyable.h>
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
-const int cMisspellingLineThickness = 3;
-const int cMisspellingLinePatternWidth = 4;
-const int cMisspellingLinePatternGapWidth = 1;
-
-class AffineTransform;
-class DrawingBuffer;
-class Generator;
 class ImageBuffer;
-class IntRect;
-class RoundedRect;
 class KURL;
-class GraphicsContext3D;
-class PlatformContextSkiaState;
-class TextRun;
-class TransformationMatrix;
-
-enum TextDrawingMode {
-    TextModeFill      = 1 << 0,
-    TextModeStroke    = 1 << 1,
-};
-typedef unsigned TextDrawingModeFlags;
-
-enum StrokeStyle {
-    NoStroke,
-    SolidStroke,
-    DottedStroke,
-    DashedStroke,
-#if ENABLE(CSS3_TEXT)
-    DoubleStroke,
-    WavyStroke,
-#endif // CSS3_TEXT
-};
-
-enum InterpolationQuality {
-    InterpolationDefault,
-    InterpolationNone,
-    InterpolationLow,
-    InterpolationMedium,
-    InterpolationHigh
-};
-
-enum CompositeOperator;
-
-struct GraphicsContextState {
-    GraphicsContextState()
-        : strokeThickness(0)
-        , shadowBlur(0)
-        , textDrawingMode(TextModeFill)
-        , strokeColor(Color::black)
-        , fillColor(Color::black)
-        , strokeStyle(SolidStroke)
-        , fillRule(RULE_NONZERO)
-        , strokeColorSpace(ColorSpaceDeviceRGB)
-        , fillColorSpace(ColorSpaceDeviceRGB)
-        , shadowColorSpace(ColorSpaceDeviceRGB)
-        , compositeOperator(CompositeSourceOver)
-        , blendMode(BlendModeNormal)
-        , shouldAntialias(true)
-        , shouldSmoothFonts(true)
-        , shouldSubpixelQuantizeFonts(true)
-        , paintingDisabled(false)
-        , shadowsIgnoreTransforms(false)
-    {
-    }
-
-    RefPtr<Gradient> strokeGradient;
-    RefPtr<Pattern> strokePattern;
-
-    RefPtr<Gradient> fillGradient;
-    RefPtr<Pattern> fillPattern;
-
-    FloatSize shadowOffset;
-
-    float strokeThickness;
-    float shadowBlur;
-
-    TextDrawingModeFlags textDrawingMode;
-
-    Color strokeColor;
-    Color fillColor;
-    Color shadowColor;
-
-    StrokeStyle strokeStyle;
-    WindRule fillRule;
-
-    ColorSpace strokeColorSpace;
-    ColorSpace fillColorSpace;
-    ColorSpace shadowColorSpace;
-
-    CompositeOperator compositeOperator;
-    BlendMode blendMode;
-
-    bool shouldAntialias : 1;
-    bool shouldSmoothFonts : 1;
-    bool shouldSubpixelQuantizeFonts : 1;
-    bool paintingDisabled : 1;
-    bool shadowsIgnoreTransforms : 1;
-};
 
 class GraphicsContext {
     WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED;
@@ -222,9 +121,6 @@
 
     // Skia state methods.
     SkDrawLooper* drawLooper() const;
-    StrokeStyle strokeStyleSkia() const;
-    float strokeThicknessSkia() const;
-    TextDrawingModeFlags textDrawingModeSkia() const;
     SkColor effectiveFillColor() const;
     int getNormalizedAlpha() const;
     bool getClipBounds(SkRect* bounds) const { return m_canvas->getClipBounds(bounds); }
@@ -233,12 +129,17 @@
 
     bool readPixels(SkBitmap* bitmap, int x, int y, SkCanvas::Config8888 config8888 = SkCanvas::kNative_Premul_Config8888)
     {
+        if (paintingDisabled())
+            return false;
+
         return m_canvas->readPixels(bitmap, x, y, config8888);
     }
 
-
     bool clipRect(const SkRect& rect, AntiAliasingMode aa = NotAntiAliased, SkRegion::Op op = SkRegion::kIntersect_Op)
     {
+        if (paintingDisabled())
+            return false;
+
         realizeSave(SkCanvas::kClip_SaveFlag);
 
         return m_canvas->clipRect(rect, op, aa == AntiAliased);
@@ -246,12 +147,14 @@
 
     void setMatrix(const SkMatrix& matrix)
     {
+        if (paintingDisabled())
+            return;
+
         realizeSave(SkCanvas::kMatrix_SaveFlag);
 
         m_canvas->setMatrix(matrix);
     }
 
-
     void setShadowsIgnoreTransforms(bool);
     bool shadowsIgnoreTransforms() const;
 
@@ -397,14 +300,11 @@
     void drawLineForText(const FloatPoint&, float width, bool printing);
     enum DocumentMarkerLineStyle {
         DocumentMarkerSpellingLineStyle,
-        DocumentMarkerGrammarLineStyle,
-        DocumentMarkerAutocorrectionReplacementLineStyle,
-        DocumentMarkerDictationAlternativesLineStyle
+        DocumentMarkerGrammarLineStyle
     };
     void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle);
 
-    bool paintingDisabled() const;
-    void setPaintingDisabled(bool);
+    bool paintingDisabled() const { return !m_canvas; }
 
     bool updatingControlTints() const;
     void setUpdatingControlTints(bool);
@@ -418,9 +318,6 @@
 
     bool hasShadow() const;
     void setShadow(const FloatSize&, float blur, const Color&, ColorSpace);
-    // Legacy shadow blur radius is used for canvas, and -webkit-box-shadow.
-    // It has different treatment of radii > 8px.
-    void setLegacyShadow(const FloatSize&, float blur, const Color&, ColorSpace);
 
     bool getShadow(FloatSize&, float&, Color&, ColorSpace&) const;
     void clearShadow();
@@ -528,6 +425,9 @@
 
     bool clipPath(const SkPath& path, AntiAliasingMode aa = NotAntiAliased, SkRegion::Op op = SkRegion::kIntersect_Op)
     {
+        if (paintingDisabled())
+            return false;
+
         realizeSave(SkCanvas::kClip_SaveFlag);
 
         return m_canvas->clipPath(path, op, aa == AntiAliased);
@@ -535,6 +435,9 @@
 
     bool clipRRect(const SkRRect& rect, AntiAliasingMode aa = NotAntiAliased, SkRegion::Op op = SkRegion::kIntersect_Op)
     {
+        if (paintingDisabled())
+            return false;
+
         realizeSave(SkCanvas::kClip_SaveFlag);
 
         return m_canvas->clipRRect(rect, op, aa == AntiAliased);
@@ -542,6 +445,9 @@
 
     bool concat(const SkMatrix& matrix)
     {
+        if (paintingDisabled())
+            return false;
+
         realizeSave(SkCanvas::kMatrix_SaveFlag);
 
         return m_canvas->concat(matrix);
@@ -567,15 +473,11 @@
     // null indicates painting is disabled. Never delete this object.
     SkCanvas* m_canvas;
 
-    // The two versions of state will be merged and rationalize in a follow on patch.
-    // FIXME: crbug.com/235470
-    // Pointer to the current drawing state. This is a cached value of
-    // mStateStack.back().
-    GraphicsContextState m_state;
-    PlatformContextSkiaState* m_skiaState;
+    // Pointer to the current drawing state. This is a cached value of m_stateStack.last().
+    GraphicsContextState* m_state;
     // States stack. Enables local drawing state change with save()/restore() calls.
-    Vector<GraphicsContextState> m_stack;
-    Vector<PlatformContextSkiaState> m_stateStack;
+    // Use OwnPtr to avoid copying the large state structure.
+    Vector<OwnPtr<GraphicsContextState> > m_stateStack;
 
     // Currently pending save flags.
     // FIXME: While defined as a bitmask of SkCanvas::SaveFlags, this is mostly used as a bool.
@@ -590,15 +492,15 @@
 #endif
     // Tracks the region painted opaque via the GraphicsContext.
     OpaqueRegionSkia m_opaqueRegion;
-    bool m_trackOpaqueRegion;
+    bool m_trackOpaqueRegion : 1;
 
-    // Are we on a high DPI display? If so, spelling and grammer markers are larger.
-    bool m_useHighResMarker;
+    // Are we on a high DPI display? If so, spelling and grammar markers are larger.
+    bool m_useHighResMarker : 1;
     // FIXME: Make this go away: crbug.com/236892
-    bool m_updatingControlTints;
-    bool m_accelerated;
-    bool m_isCertainlyOpaque;
-    bool m_printing;
+    bool m_updatingControlTints : 1;
+    bool m_accelerated : 1;
+    bool m_isCertainlyOpaque : 1;
+    bool m_printing : 1;
 };
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/GraphicsContext3D.cpp b/Source/core/platform/graphics/GraphicsContext3D.cpp
index 4e9f823..387cd69 100644
--- a/Source/core/platform/graphics/GraphicsContext3D.cpp
+++ b/Source/core/platform/graphics/GraphicsContext3D.cpp
@@ -987,12 +987,12 @@
 //----------------------------------------------------------------------
 // Pixel unpacking routines.
 template<int format, typename SourceType, typename DstType>
-ALWAYS_INLINE void unpack(const SourceType*, DstType*, unsigned)
+void unpack(const SourceType*, DstType*, unsigned)
 {
     ASSERT_NOT_REACHED();
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGB8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRGB8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1004,7 +1004,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatBGR8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatBGR8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[2];
@@ -1016,7 +1016,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatARGB8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatARGB8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[1];
@@ -1028,7 +1028,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatABGR8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatABGR8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[3];
@@ -1040,7 +1040,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatBGRA8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatBGRA8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     const uint32_t* source32 = reinterpret_cast_ptr<const uint32_t*>(source);
     uint32_t* destination32 = reinterpret_cast_ptr<uint32_t*>(destination);
@@ -1058,7 +1058,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGBA5551, uint16_t, uint8_t>(const uint16_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRGBA5551, uint16_t, uint8_t>(const uint16_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
 #if HAVE(ARM_NEON_INTRINSICS)
     SIMD::unpackOneRowOfRGBA5551ToRGBA8(source, destination, pixelsPerRow);
@@ -1077,7 +1077,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGBA4444, uint16_t, uint8_t>(const uint16_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRGBA4444, uint16_t, uint8_t>(const uint16_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
 #if HAVE(ARM_NEON_INTRINSICS)
     SIMD::unpackOneRowOfRGBA4444ToRGBA8(source, destination, pixelsPerRow);
@@ -1097,7 +1097,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGB565, uint16_t, uint8_t>(const uint16_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRGB565, uint16_t, uint8_t>(const uint16_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
 #if HAVE(ARM_NEON_INTRINSICS)
     SIMD::unpackOneRowOfRGB565ToRGBA8(source, destination, pixelsPerRow);
@@ -1116,7 +1116,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatR8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatR8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1128,7 +1128,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRA8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRA8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1140,7 +1140,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatAR8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatAR8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[1];
@@ -1152,7 +1152,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatA8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatA8, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = 0x0;
@@ -1164,7 +1164,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGBA8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRGBA8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
 {
     const float scaleFactor = 1.0f / 255.0f;
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
@@ -1177,7 +1177,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatBGRA8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatBGRA8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
 {
     const float scaleFactor = 1.0f / 255.0f;
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
@@ -1190,7 +1190,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatABGR8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatABGR8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
 {
     const float scaleFactor = 1.0f / 255.0f;
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
@@ -1203,7 +1203,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatARGB8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatARGB8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
 {
     const float scaleFactor = 1.0f / 255.0f;
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
@@ -1216,7 +1216,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGB8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRGB8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
 {
     const float scaleFactor = 1.0f / 255.0f;
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
@@ -1229,7 +1229,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatBGR8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatBGR8, uint8_t, float>(const uint8_t* source, float* destination, unsigned pixelsPerRow)
 {
     const float scaleFactor = 1.0f / 255.0f;
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
@@ -1242,7 +1242,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRGB32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRGB32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1254,7 +1254,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatR32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatR32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1266,7 +1266,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatRA32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatRA32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1278,7 +1278,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void unpack<GraphicsContext3D::DataFormatA32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void unpack<GraphicsContext3D::DataFormatA32F, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = 0;
@@ -1295,12 +1295,12 @@
 //
 
 template<int format, int alphaOp, typename SourceType, typename DstType>
-ALWAYS_INLINE void pack(const SourceType*, DstType*, unsigned)
+void pack(const SourceType*, DstType*, unsigned)
 {
     ASSERT_NOT_REACHED();
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatA8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatA8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[3];
@@ -1309,7 +1309,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1318,7 +1318,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR8, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR8, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] / 255.0f;
@@ -1330,7 +1330,7 @@
 }
 
 // FIXME: this routine is lossy and must be removed.
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR8, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR8, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f;
@@ -1341,7 +1341,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1351,7 +1351,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA8, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA8, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] / 255.0f;
@@ -1364,7 +1364,7 @@
 }
 
 // FIXME: this routine is lossy and must be removed.
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA8, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA8, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f;
@@ -1376,7 +1376,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1387,7 +1387,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB8, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB8, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] / 255.0f;
@@ -1403,7 +1403,7 @@
 }
 
 // FIXME: this routine is lossy and must be removed.
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB8, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB8, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f;
@@ -1419,12 +1419,12 @@
 }
 
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA8, GraphicsContext3D::AlphaDoNothing, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     memcpy(destination, source, pixelsPerRow * 4);
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA8, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA8, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] / 255.0f;
@@ -1441,7 +1441,7 @@
 }
 
 // FIXME: this routine is lossy and must be removed.
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA8, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA8, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint8_t>(const uint8_t* source, uint8_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f;
@@ -1457,7 +1457,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA4444, GraphicsContext3D::AlphaDoNothing, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA4444, GraphicsContext3D::AlphaDoNothing, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
 #if HAVE(ARM_NEON_INTRINSICS)
     SIMD::packOneRowOfRGBA8ToUnsignedShort4444(source, destination, pixelsPerRow);
@@ -1472,7 +1472,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA4444, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA4444, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] / 255.0f;
@@ -1489,7 +1489,7 @@
 }
 
 // FIXME: this routine is lossy and must be removed.
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA4444, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA4444, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f;
@@ -1505,7 +1505,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA5551, GraphicsContext3D::AlphaDoNothing, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA5551, GraphicsContext3D::AlphaDoNothing, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
 #if HAVE(ARM_NEON_INTRINSICS)
     SIMD::packOneRowOfRGBA8ToUnsignedShort5551(source, destination, pixelsPerRow);
@@ -1520,7 +1520,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA5551, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA5551, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] / 255.0f;
@@ -1537,7 +1537,7 @@
 }
 
 // FIXME: this routine is lossy and must be removed.
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA5551, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA5551, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f;
@@ -1553,7 +1553,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB565, GraphicsContext3D::AlphaDoNothing, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB565, GraphicsContext3D::AlphaDoNothing, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
 #if HAVE(ARM_NEON_INTRINSICS)
     SIMD::packOneRowOfRGBA8ToUnsignedShort565(source, destination, pixelsPerRow);
@@ -1567,7 +1567,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB565, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB565, GraphicsContext3D::AlphaDoPremultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] / 255.0f;
@@ -1583,7 +1583,7 @@
 }
 
 // FIXME: this routine is lossy and must be removed.
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB565, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB565, GraphicsContext3D::AlphaDoUnmultiply, uint8_t, uint16_t>(const uint8_t* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f;
@@ -1598,7 +1598,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1609,7 +1609,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB32F, GraphicsContext3D::AlphaDoPremultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB32F, GraphicsContext3D::AlphaDoPremultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3];
@@ -1621,7 +1621,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB32F, GraphicsContext3D::AlphaDoUnmultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB32F, GraphicsContext3D::AlphaDoUnmultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 1.0f / source[3] : 1.0f;
@@ -1634,12 +1634,12 @@
 }
 
 // Used only during RGBA8 or BGRA8 -> floating-point uploads.
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     memcpy(destination, source, pixelsPerRow * 4 * sizeof(float));
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA32F, GraphicsContext3D::AlphaDoPremultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA32F, GraphicsContext3D::AlphaDoPremultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3];
@@ -1652,7 +1652,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA32F, GraphicsContext3D::AlphaDoUnmultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA32F, GraphicsContext3D::AlphaDoUnmultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 1.0f / source[3] : 1.0f;
@@ -1665,7 +1665,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatA32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatA32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[3];
@@ -1674,7 +1674,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1683,7 +1683,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR32F, GraphicsContext3D::AlphaDoPremultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR32F, GraphicsContext3D::AlphaDoPremultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3];
@@ -1693,7 +1693,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR32F, GraphicsContext3D::AlphaDoUnmultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR32F, GraphicsContext3D::AlphaDoUnmultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 1.0f / source[3] : 1.0f;
@@ -1703,7 +1703,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA32F, GraphicsContext3D::AlphaDoNothing, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         destination[0] = source[0];
@@ -1713,7 +1713,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA32F, GraphicsContext3D::AlphaDoPremultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA32F, GraphicsContext3D::AlphaDoPremultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3];
@@ -1724,7 +1724,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA32F, GraphicsContext3D::AlphaDoUnmultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA32F, GraphicsContext3D::AlphaDoUnmultiply, float, float>(const float* source, float* destination, unsigned pixelsPerRow)
 {
     for (unsigned int i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 1.0f / source[3] : 1.0f;
@@ -1735,7 +1735,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         destination[0] = convertFloatToHalfFloat(source[0]);
@@ -1747,7 +1747,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA16F, GraphicsContext3D::AlphaDoPremultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA16F, GraphicsContext3D::AlphaDoPremultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3];
@@ -1760,7 +1760,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGBA16F, GraphicsContext3D::AlphaDoUnmultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGBA16F, GraphicsContext3D::AlphaDoUnmultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 1.0f / source[3] : 1.0f;
@@ -1773,7 +1773,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         destination[0] = convertFloatToHalfFloat(source[0]);
@@ -1784,7 +1784,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB16F, GraphicsContext3D::AlphaDoPremultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB16F, GraphicsContext3D::AlphaDoPremultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3];
@@ -1796,7 +1796,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRGB16F, GraphicsContext3D::AlphaDoUnmultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRGB16F, GraphicsContext3D::AlphaDoUnmultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 1.0f / source[3] : 1.0f;
@@ -1808,7 +1808,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         destination[0] = convertFloatToHalfFloat(source[0]);
@@ -1818,7 +1818,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA16F, GraphicsContext3D::AlphaDoPremultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA16F, GraphicsContext3D::AlphaDoPremultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3];
@@ -1829,7 +1829,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatRA16F, GraphicsContext3D::AlphaDoUnmultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatRA16F, GraphicsContext3D::AlphaDoUnmultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 1.0f / source[3] : 1.0f;
@@ -1840,7 +1840,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         destination[0] = convertFloatToHalfFloat(source[0]);
@@ -1849,7 +1849,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR16F, GraphicsContext3D::AlphaDoPremultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR16F, GraphicsContext3D::AlphaDoPremultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3];
@@ -1859,7 +1859,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatR16F, GraphicsContext3D::AlphaDoUnmultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatR16F, GraphicsContext3D::AlphaDoUnmultiply, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         float scaleFactor = source[3] ? 1.0f / source[3] : 1.0f;
@@ -1869,7 +1869,7 @@
     }
 }
 
-template<> ALWAYS_INLINE void pack<GraphicsContext3D::DataFormatA16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
+template<> void pack<GraphicsContext3D::DataFormatA16F, GraphicsContext3D::AlphaDoNothing, float, uint16_t>(const float* source, uint16_t* destination, unsigned pixelsPerRow)
 {
     for (unsigned i = 0; i < pixelsPerRow; ++i) {
         destination[0] = convertFloatToHalfFloat(source[3]);
@@ -1878,7 +1878,7 @@
     }
 }
 
-ALWAYS_INLINE bool HasAlpha(int format)
+bool HasAlpha(int format)
 {
     return format == GraphicsContext3D::DataFormatA8
         || format == GraphicsContext3D::DataFormatA16F
@@ -1897,7 +1897,7 @@
         || format == GraphicsContext3D::DataFormatRGBA5551;
 }
 
-ALWAYS_INLINE bool HasColor(int format)
+bool HasColor(int format)
 {
     return format == GraphicsContext3D::DataFormatRGBA8
         || format == GraphicsContext3D::DataFormatRGBA16F
@@ -1974,7 +1974,7 @@
     static const int Value = (IsFloatFormat<Format>::Value || IsHalfFloatFormat<Format>::Value) ? GraphicsContext3D::DataFormatRGBA32F : GraphicsContext3D::DataFormatRGBA8;
 };
 
-ALWAYS_INLINE unsigned TexelBytesForFormat(GraphicsContext3D::DataFormat format)
+unsigned TexelBytesForFormat(GraphicsContext3D::DataFormat format)
 {
     switch (format) {
     case GraphicsContext3D::DataFormatR8:
@@ -2032,13 +2032,13 @@
 
 private:
     template<GraphicsContext3D::DataFormat SrcFormat>
-    ALWAYS_INLINE void convert(GraphicsContext3D::DataFormat dstFormat, GraphicsContext3D::AlphaOp);
+    void convert(GraphicsContext3D::DataFormat dstFormat, GraphicsContext3D::AlphaOp);
 
     template<GraphicsContext3D::DataFormat SrcFormat, GraphicsContext3D::DataFormat DstFormat>
-    ALWAYS_INLINE void convert(GraphicsContext3D::AlphaOp);
+    void convert(GraphicsContext3D::AlphaOp);
 
     template<GraphicsContext3D::DataFormat SrcFormat, GraphicsContext3D::DataFormat DstFormat, GraphicsContext3D::AlphaOp alphaOp>
-    ALWAYS_INLINE void convert();
+    void convert();
 
     const unsigned m_width, m_height;
     const void* const m_srcStart;
@@ -2080,7 +2080,7 @@
 }
 
 template<GraphicsContext3D::DataFormat SrcFormat>
-ALWAYS_INLINE void FormatConverter::convert(GraphicsContext3D::DataFormat dstFormat, GraphicsContext3D::AlphaOp alphaOp)
+void FormatConverter::convert(GraphicsContext3D::DataFormat dstFormat, GraphicsContext3D::AlphaOp alphaOp)
 {
 #define FORMATCONVERTER_CASE_DSTFORMAT(DstFormat) \
     case DstFormat: \
@@ -2113,7 +2113,7 @@
 }
 
 template<GraphicsContext3D::DataFormat SrcFormat, GraphicsContext3D::DataFormat DstFormat>
-ALWAYS_INLINE void FormatConverter::convert(GraphicsContext3D::AlphaOp alphaOp)
+void FormatConverter::convert(GraphicsContext3D::AlphaOp alphaOp)
 {
 #define FORMATCONVERTER_CASE_ALPHAOP(alphaOp) \
     case alphaOp: \
@@ -2130,7 +2130,7 @@
 }
 
 template<GraphicsContext3D::DataFormat SrcFormat, GraphicsContext3D::DataFormat DstFormat, GraphicsContext3D::AlphaOp alphaOp>
-ALWAYS_INLINE void FormatConverter::convert()
+void FormatConverter::convert()
 {
     // Many instantiations of this template function will never be entered, so we try
     // to return immediately in these cases to avoid the compiler to generate useless code.
diff --git a/Source/core/platform/graphics/GraphicsContextState.h b/Source/core/platform/graphics/GraphicsContextState.h
new file mode 100644
index 0000000..9d27ba4
--- /dev/null
+++ b/Source/core/platform/graphics/GraphicsContextState.h
@@ -0,0 +1,218 @@
+// Copyright (C) 2013 Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//    * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//    * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//    * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef GraphicsContextState_h
+#define GraphicsContextState_h
+
+#include "core/platform/graphics/ColorSpace.h"
+#include "core/platform/graphics/Gradient.h"
+#include "core/platform/graphics/GraphicsTypes.h"
+#include "core/platform/graphics/Path.h"
+#include "core/platform/graphics/Pattern.h"
+
+#include "third_party/skia/include/core/SkColorPriv.h"
+#include "third_party/skia/include/effects/SkDashPathEffect.h"
+
+#include "wtf/PassOwnPtr.h"
+
+namespace WebCore {
+
+// Encapsulates the state information we store for each pushed graphics state.
+// Only GraphicsContext can use this class.
+class GraphicsContextState {
+public:
+    ~GraphicsContextState()
+    {
+        SkSafeUnref(m_looper);
+        SkSafeUnref(m_dash);
+    }
+
+private:
+    friend class GraphicsContext;
+
+    GraphicsContextState()
+        : m_strokeStyle(SolidStroke)
+        , m_strokeThickness(0)
+        , m_strokeColor(Color::black)
+        , m_strokeColorPacked(0xFF000000)
+        , m_strokeColorSpace(ColorSpaceDeviceRGB)
+        , m_dashRatio(3)
+        , m_miterLimit(4)
+        , m_lineCap(SkPaint::kDefault_Cap)
+        , m_lineJoin(SkPaint::kDefault_Join)
+        , m_dash(0)
+        , m_fillColor(Color::black)
+        , m_fillColorPacked(0xFF000000)
+        , m_fillColorSpace(ColorSpaceDeviceRGB)
+        , m_fillRule(RULE_NONZERO)
+        , m_shadowBlur(0)
+        , m_shadowColorSpace(ColorSpaceDeviceRGB)
+        , m_textDrawingMode(TextModeFill)
+        , m_alpha(1)
+        , m_xferMode(SkXfermode::kSrcOver_Mode)
+        , m_looper(0)
+        , m_compositeOperator(CompositeSourceOver)
+        , m_blendMode(BlendModeNormal)
+        , m_clip(SkRect::MakeEmpty())
+#if USE(LOW_QUALITY_IMAGE_INTERPOLATION)
+        , m_interpolationQuality(InterpolationLow)
+#else
+        , m_interpolationQuality(InterpolationHigh)
+#endif
+        , m_shouldAntialias(true)
+        , m_shouldSmoothFonts(true)
+        , m_shouldSubpixelQuantizeFonts(true)
+        , m_shadowsIgnoreTransforms(false)
+    {
+    }
+
+    GraphicsContextState(const GraphicsContextState& other)
+        : m_strokeStyle(other.m_strokeStyle)
+        , m_strokeThickness(other.m_strokeThickness)
+        , m_strokeColor(other.m_strokeColor)
+        , m_strokeColorPacked(other.m_strokeColorPacked)
+        , m_strokeColorSpace(other.m_strokeColorSpace)
+        , m_strokeGradient(other.m_strokeGradient)
+        , m_strokePattern(other.m_strokePattern)
+        , m_dashRatio(other.m_dashRatio)
+        , m_miterLimit(other.m_miterLimit)
+        , m_lineCap(other.m_lineCap)
+        , m_lineJoin(other.m_lineJoin)
+        , m_dash(other.m_dash)
+        , m_fillColor(other.m_fillColor)
+        , m_fillColorPacked(other.m_fillColorPacked)
+        , m_fillColorSpace(other.m_fillColorSpace)
+        , m_fillRule(other.m_fillRule)
+        , m_fillGradient(other.m_fillGradient)
+        , m_fillPattern(other.m_fillPattern)
+        , m_shadowBlur(other.m_shadowBlur)
+        , m_shadowColor(other.m_shadowColor)
+        , m_shadowOffset(other.m_shadowOffset)
+        , m_shadowColorSpace(other.m_shadowColorSpace)
+        , m_textDrawingMode(other.m_textDrawingMode)
+        , m_alpha(other.m_alpha)
+        , m_xferMode(other.m_xferMode)
+        , m_looper(other.m_looper)
+        , m_compositeOperator(other.m_compositeOperator)
+        , m_blendMode(other.m_blendMode)
+        , m_imageBufferClip(other.m_imageBufferClip)
+        , m_clip(other.m_clip)
+        , m_interpolationQuality(other.m_interpolationQuality)
+        , m_shouldAntialias(other.m_shouldAntialias)
+        , m_shouldSmoothFonts(other.m_shouldSmoothFonts)
+        , m_shouldSubpixelQuantizeFonts(other.m_shouldSubpixelQuantizeFonts)
+        , m_shadowsIgnoreTransforms(other.m_shadowsIgnoreTransforms)
+    {
+        // Up the ref count of these. SkSafeRef does nothing if its argument is 0.
+        SkSafeRef(m_looper);
+        SkSafeRef(m_dash);
+
+        // The clip image only needs to be applied once. Reset the image so that we
+        // don't attempt to clip multiple times.
+        m_imageBufferClip.reset();
+    }
+
+    // Helper function for applying the state's alpha value to the given input
+    // color to produce a new output color.
+    SkColor applyAlpha(SkColor c) const
+    {
+        int s = roundf(m_alpha * 256);
+        if (s >= 256)
+            return c;
+        if (s < 0)
+            return 0;
+
+        int a = SkAlphaMul(SkColorGetA(c), s);
+        return (c & 0x00FFFFFF) | (a << 24);
+    }
+
+    // Returns a new State with all of this object's inherited properties copied.
+    PassOwnPtr<GraphicsContextState> clone() { return adoptPtr(new GraphicsContextState(*this)); }
+
+    // Not supported. No implementations.
+    void operator=(const GraphicsContextState&);
+
+    // Stroke.
+    StrokeStyle m_strokeStyle;
+    float m_strokeThickness;
+    Color m_strokeColor;
+    SkColor m_strokeColorPacked;
+    ColorSpace m_strokeColorSpace;
+    RefPtr<Gradient> m_strokeGradient;
+    RefPtr<Pattern> m_strokePattern;
+    int m_dashRatio; // Ratio of the length of a dash to its width.
+    float m_miterLimit;
+    SkPaint::Cap m_lineCap;
+    SkPaint::Join m_lineJoin;
+    SkDashPathEffect* m_dash;
+
+    // Fill.
+    Color m_fillColor;
+    SkColor m_fillColorPacked;
+    ColorSpace m_fillColorSpace;
+    WindRule m_fillRule;
+    RefPtr<Gradient> m_fillGradient;
+    RefPtr<Pattern> m_fillPattern;
+
+    // Shadow.
+    float m_shadowBlur;
+    Color m_shadowColor;
+    FloatSize m_shadowOffset;
+    ColorSpace m_shadowColorSpace;
+
+    // Text. (See TextModeFill & friends.)
+    TextDrawingModeFlags m_textDrawingMode;
+
+    // Common shader state.
+    float m_alpha;
+    SkXfermode::Mode m_xferMode;
+    SkDrawLooper* m_looper;
+
+    // Compositing control, for the CSS and Canvas compositing spec.
+    CompositeOperator m_compositeOperator;
+    BlendMode m_blendMode;
+
+    // If non-empty, the current State is clipped to this image.
+    SkBitmap m_imageBufferClip;
+
+    // If m_imageBufferClip is non-empty, this is the region the image is clipped to.
+    SkRect m_clip;
+
+    // Image interpolation control.
+    InterpolationQuality m_interpolationQuality;
+
+    bool m_shouldAntialias : 1;
+    bool m_shouldSmoothFonts : 1;
+    bool m_shouldSubpixelQuantizeFonts : 1;
+    bool m_shadowsIgnoreTransforms : 1;
+};
+
+} // namespace WebCore
+
+#endif // GraphicsContextState_h
+
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp
index c770f3d..cbccc1f 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -27,33 +27,52 @@
 
 #include "core/platform/graphics/GraphicsLayer.h"
 
+#include "SkImageFilter.h"
+#include "SkMatrix44.h"
 #include "core/platform/PlatformMemoryInstrumentation.h"
+#include "core/platform/ScrollableArea.h"
 #include "core/platform/graphics/FloatPoint.h"
 #include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/LayoutRect.h"
+#include "core/platform/graphics/chromium/AnimationTranslationUtil.h"
 #include "core/platform/graphics/chromium/TransformSkMatrix44Conversions.h"
+#include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
+#include "core/platform/graphics/skia/NativeImageSkia.h"
 #include "core/platform/graphics/transforms/RotateTransformOperation.h"
 #include "core/platform/text/TextStream.h"
 
+#include "wtf/CurrentTime.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
+#include "wtf/MemoryInstrumentationVector.h"
+#include "wtf/StringExtras.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/StringHash.h"
+#include "wtf/text/WTFString.h"
+
 #include <public/Platform.h>
+#include <public/WebAnimation.h>
 #include <public/WebCompositorSupport.h>
+#include <public/WebFilterOperation.h>
+#include <public/WebFilterOperations.h>
 #include <public/WebFloatPoint.h>
 #include <public/WebFloatRect.h>
+#include <public/WebPoint.h>
 #include <public/WebSize.h>
 
-#include <wtf/HashMap.h>
-#include <wtf/MemoryInstrumentationVector.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
-
 #ifndef NDEBUG
 #include <stdio.h>
 #endif
 
-using WebKit::WebLayer;
 using WebKit::Platform;
+using WebKit::WebAnimation;
+using WebKit::WebFilterOperation;
+using WebKit::WebFilterOperations;
+using WebKit::WebLayer;
+using WebKit::WebPoint;
 
 namespace WebCore {
 
@@ -64,10 +83,10 @@
     return map;
 }
 
-void KeyframeValueList::insert(const AnimationValue* value)
+void KeyframeValueList::insert(PassOwnPtr<const AnimationValue> value)
 {
     for (size_t i = 0; i < m_values.size(); ++i) {
-        const AnimationValue* curValue = m_values[i];
+        const AnimationValue* curValue = m_values[i].get();
         if (curValue->keyTime() == value->keyTime()) {
             ASSERT_NOT_REACHED();
             // insert after
@@ -95,7 +114,6 @@
     , m_masksToBounds(false)
     , m_drawsContent(false)
     , m_contentsVisible(true)
-    , m_maintainsPixelAlignment(false)
     , m_showDebugBorder(false)
     , m_showRepaintCounter(false)
     , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
@@ -126,6 +144,11 @@
 
 void GraphicsLayer::willBeDestroyed()
 {
+    if (m_linkHighlight) {
+        m_linkHighlight->clearCurrentGraphicsLayer();
+        m_linkHighlight = 0;
+    }
+
 #ifndef NDEBUG
     if (m_client)
         m_client->verifyNotPainting();
@@ -159,16 +182,25 @@
 
 bool GraphicsLayer::setChildren(const Vector<GraphicsLayer*>& newChildren)
 {
+    // FIXME: change m_inSetChildren mechanism to addChildInternal()
+    m_inSetChildren = true;
+
     // If the contents of the arrays are the same, nothing to do.
-    if (newChildren == m_children)
+    if (newChildren == m_children) {
+        m_inSetChildren = false;
         return false;
+    }
 
     removeAllChildren();
-    
+
     size_t listSize = newChildren.size();
     for (size_t i = 0; i < listSize; ++i)
         addChild(newChildren[i]);
-    
+
+    updateChildList();
+
+    m_inSetChildren = false;
+
     return true;
 }
 
@@ -181,6 +213,9 @@
 
     childLayer->setParent(this);
     m_children.append(childLayer);
+
+    if (!m_inSetChildren)
+        updateChildList();
 }
 
 void GraphicsLayer::addChildAtIndex(GraphicsLayer* childLayer, int index)
@@ -192,6 +227,8 @@
 
     childLayer->setParent(this);
     m_children.insert(index, childLayer);
+
+    updateChildList();
 }
 
 void GraphicsLayer::addChildBelow(GraphicsLayer* childLayer, GraphicsLayer* sibling)
@@ -212,6 +249,8 @@
 
     if (!found)
         m_children.append(childLayer);
+
+    updateChildList();
 }
 
 void GraphicsLayer::addChildAbove(GraphicsLayer* childLayer, GraphicsLayer* sibling)
@@ -232,6 +271,8 @@
 
     if (!found)
         m_children.append(childLayer);
+
+    updateChildList();
 }
 
 bool GraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild)
@@ -245,13 +286,17 @@
             break;
         }
     }
+
     if (found) {
         oldChild->setParent(0);
 
         newChild->removeFromParent();
         newChild->setParent(this);
+
+        updateChildList();
         return true;
     }
+
     return false;
 }
 
@@ -277,36 +322,25 @@
 
         setParent(0);
     }
-}
 
-void GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants()
-{
-    deviceOrPageScaleFactorChanged();
-
-    if (m_maskLayer)
-        m_maskLayer->deviceOrPageScaleFactorChanged();
-
-    if (m_replicaLayer)
-        m_replicaLayer->noteDeviceOrPageScaleFactorChangedIncludingDescendants();
-
-    const Vector<GraphicsLayer*>& childLayers = children();
-    size_t numChildren = childLayers.size();
-    for (size_t i = 0; i < numChildren; ++i)
-        childLayers[i]->noteDeviceOrPageScaleFactorChangedIncludingDescendants();
+    platformLayer()->removeFromParent();
 }
 
 void GraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer)
 {
-    if (m_replicaLayer == layer)
-        return;
+    // FIXME: this could probably be a full early exit.
+    if (m_replicaLayer != layer) {
+        if (m_replicaLayer)
+            m_replicaLayer->setReplicatedLayer(0);
 
-    if (m_replicaLayer)
-        m_replicaLayer->setReplicatedLayer(0);
+        if (layer)
+            layer->setReplicatedLayer(this);
 
-    if (layer)
-        layer->setReplicatedLayer(this);
+        m_replicaLayer = layer;
+    }
 
-    m_replicaLayer = layer;
+    WebLayer* webReplicaLayer = layer ? layer->platformLayer() : 0;
+    platformLayer()->setReplicaLayer(webReplicaLayer);
 }
 
 void GraphicsLayer::setOffsetFromRenderer(const IntSize& offset, ShouldSetNeedsDisplay shouldSetNeedsDisplay)
@@ -321,11 +355,6 @@
         setNeedsDisplay();
 }
 
-void GraphicsLayer::setBackgroundColor(const Color& color)
-{
-    m_backgroundColor = color;
-}
-
 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const IntRect& clip)
 {
     if (m_client) {
@@ -349,14 +378,6 @@
     return id.toString();
 }
 
-void GraphicsLayer::suspendAnimations(double)
-{
-}
-
-void GraphicsLayer::resumeAnimations()
-{
-}
-
 void GraphicsLayer::getDebugBorderInfo(Color& color, float& width) const
 {
     if (drawsContent()) {
@@ -407,8 +428,6 @@
     // opacity to get the total contribution
     accumulatedOpacity *= m_opacity;
     
-    setOpacityInternal(accumulatedOpacity);
-    
     if (preserves3D()) {
         size_t numChildren = children().size();
         for (size_t i = 0; i < numChildren; ++i)
@@ -1026,6 +1045,396 @@
     info.addMember(m_replicatedLayer, "replicatedLayer");
     info.ignoreMember(m_client);
     info.addMember(m_name, "name");
+    info.addMember(m_nameBase, "nameBase");
+    info.addMember(m_layer, "layer");
+    info.addMember(m_transformLayer, "transformLayer");
+    info.addMember(m_imageLayer, "imageLayer");
+    info.addMember(m_contentsLayer, "contentsLayer");
+    info.addMember(m_linkHighlight, "linkHighlight");
+    info.addMember(m_opaqueRectTrackingContentLayerDelegate, "opaqueRectTrackingContentLayerDelegate");
+    info.addMember(m_animationIdMap, "animationIdMap");
+    info.addMember(m_scrollableArea, "scrollableArea");
+}
+
+void GraphicsLayer::setName(const String& name)
+{
+    m_nameBase = name;
+    m_name = String::format("GraphicsLayer(%p) ", this) + name;
+    updateNames();
+}
+
+int GraphicsLayer::debugID() const
+{
+    // FIXME: change this to assert m_layer always exists, and remove enum.
+    return m_layer ? m_layer->layer()->id() : DebugIDNoCompositedLayer;
+}
+
+void GraphicsLayer::setPosition(const FloatPoint& point)
+{
+    m_position = point;
+    updateLayerPosition();
+}
+
+void GraphicsLayer::setAnchorPoint(const FloatPoint3D& point)
+{
+    m_anchorPoint = point;
+    updateAnchorPoint();
+}
+
+void GraphicsLayer::setSize(const FloatSize& size)
+{
+    // We are receiving negative sizes here that cause assertions to fail in the compositor. Clamp them to 0 to
+    // avoid those assertions.
+    // FIXME: This should be an ASSERT instead, as negative sizes should not exist in WebCore.
+    FloatSize clampedSize = size;
+    if (clampedSize.width() < 0 || clampedSize.height() < 0)
+        clampedSize = FloatSize();
+
+    if (clampedSize == m_size)
+        return;
+
+    m_size = clampedSize;
+    updateLayerSize();
+}
+
+void GraphicsLayer::setTransform(const TransformationMatrix& transform)
+{
+    m_transform = transform;
+    updateTransform();
+}
+
+void GraphicsLayer::setChildrenTransform(const TransformationMatrix& transform)
+{
+    m_childrenTransform = transform;
+    updateChildrenTransform();
+}
+
+void GraphicsLayer::setPreserves3D(bool preserves3D)
+{
+    if (preserves3D == m_preserves3D)
+        return;
+
+    m_preserves3D = preserves3D;
+    updateLayerPreserves3D();
+}
+
+void GraphicsLayer::setMasksToBounds(bool masksToBounds)
+{
+    m_masksToBounds = masksToBounds;
+    updateMasksToBounds();
+}
+
+void GraphicsLayer::setDrawsContent(bool drawsContent)
+{
+    // Note carefully this early-exit is only correct because we also properly call
+    // WebLayer::setDrawsContent whenever m_contentsLayer is set to a new layer in setupContentsLayer().
+    if (drawsContent == m_drawsContent)
+        return;
+
+    m_drawsContent = drawsContent;
+    updateLayerIsDrawable();
+}
+
+void GraphicsLayer::setContentsVisible(bool contentsVisible)
+{
+    // Note carefully this early-exit is only correct because we also properly call
+    // WebLayer::setDrawsContent whenever m_contentsLayer is set to a new layer in setupContentsLayer().
+    if (contentsVisible == m_contentsVisible)
+        return;
+
+    m_contentsVisible = contentsVisible;
+    updateLayerIsDrawable();
+}
+
+void GraphicsLayer::setBackgroundColor(const Color& color)
+{
+    if (color == m_backgroundColor)
+        return;
+
+    m_backgroundColor = color;
+    updateLayerBackgroundColor();
+}
+
+void GraphicsLayer::setContentsOpaque(bool opaque)
+{
+    m_contentsOpaque = opaque;
+    m_layer->layer()->setOpaque(m_contentsOpaque);
+    m_opaqueRectTrackingContentLayerDelegate->setOpaque(m_contentsOpaque);
+}
+
+void GraphicsLayer::setMaskLayer(GraphicsLayer* maskLayer)
+{
+    if (maskLayer == m_maskLayer)
+        return;
+
+    m_maskLayer = maskLayer;
+    WebLayer* maskWebLayer = m_maskLayer ? m_maskLayer->platformLayer() : 0;
+    m_layer->layer()->setMaskLayer(maskWebLayer);
+}
+
+void GraphicsLayer::setBackfaceVisibility(bool visible)
+{
+    m_backfaceVisibility = visible;
+    m_layer->setDoubleSided(m_backfaceVisibility);
+}
+
+void GraphicsLayer::setOpacity(float opacity)
+{
+    float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f);
+    m_opacity = clampedOpacity;
+    platformLayer()->setOpacity(opacity);
+}
+
+void GraphicsLayer::setContentsNeedsDisplay()
+{
+    if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
+        contentsLayer->invalidate();
+        addRepaintRect(contentsRect());
+    }
+}
+
+void GraphicsLayer::setNeedsDisplay()
+{
+    if (drawsContent()) {
+        m_layer->layer()->invalidate();
+        addRepaintRect(FloatRect(FloatPoint(), m_size));
+        if (m_linkHighlight)
+            m_linkHighlight->invalidate();
+    }
+}
+
+void GraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect)
+{
+    if (drawsContent()) {
+        m_layer->layer()->invalidateRect(rect);
+        addRepaintRect(rect);
+        if (m_linkHighlight)
+            m_linkHighlight->invalidate();
+    }
+}
+
+void GraphicsLayer::setContentsRect(const IntRect& rect)
+{
+    if (rect == m_contentsRect)
+        return;
+
+    m_contentsRect = rect;
+    updateContentsRect();
+}
+
+void GraphicsLayer::setContentsToImage(Image* image)
+{
+    bool childrenChanged = false;
+    RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFrame() : 0;
+    if (nativeImage) {
+        if (m_contentsLayerPurpose != ContentsLayerForImage) {
+            m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->createImageLayer());
+            registerContentsLayer(m_imageLayer->layer());
+
+            setupContentsLayer(m_imageLayer->layer());
+            m_contentsLayerPurpose = ContentsLayerForImage;
+            childrenChanged = true;
+        }
+        m_imageLayer->setBitmap(nativeImage->bitmap());
+        m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
+        updateContentsRect();
+    } else {
+        if (m_imageLayer) {
+            childrenChanged = true;
+
+            unregisterContentsLayer(m_imageLayer->layer());
+            m_imageLayer.clear();
+        }
+        // The old contents layer will be removed via updateChildList.
+        m_contentsLayer = 0;
+    }
+
+    if (childrenChanged)
+        updateChildList();
+}
+
+void GraphicsLayer::setContentsToCanvas(PlatformLayer* layer)
+{
+    setContentsTo(ContentsLayerForCanvas, layer);
+}
+
+void GraphicsLayer::setContentsToMedia(PlatformLayer* layer)
+{
+    setContentsTo(ContentsLayerForVideo, layer);
+}
+
+bool GraphicsLayer::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const CSSAnimationData* animation, const String& animationName, double timeOffset)
+{
+    setAnimationDelegateForLayer(platformLayer());
+
+    int animationId = 0;
+
+    if (m_animationIdMap.contains(animationName))
+        animationId = m_animationIdMap.get(animationName);
+
+    OwnPtr<WebAnimation> toAdd(createWebAnimation(values, animation, animationId, timeOffset, boxSize));
+
+    if (toAdd) {
+        animationId = toAdd->id();
+        m_animationIdMap.set(animationName, animationId);
+
+        // Remove any existing animations with the same animation id and target property.
+        platformLayer()->removeAnimation(animationId, toAdd->targetProperty());
+        return platformLayer()->addAnimation(toAdd.get());
+    }
+
+    return false;
+}
+
+void GraphicsLayer::pauseAnimation(const String& animationName, double timeOffset)
+{
+    if (m_animationIdMap.contains(animationName))
+        platformLayer()->pauseAnimation(m_animationIdMap.get(animationName), timeOffset);
+}
+
+void GraphicsLayer::removeAnimation(const String& animationName)
+{
+    if (m_animationIdMap.contains(animationName))
+        platformLayer()->removeAnimation(m_animationIdMap.get(animationName));
+}
+
+void GraphicsLayer::suspendAnimations(double wallClockTime)
+{
+    // |wallClockTime| is in the wrong time base. Need to convert here.
+    // FIXME: find a more reliable way to do this.
+    double monotonicTime = wallClockTime + monotonicallyIncreasingTime() - currentTime();
+    platformLayer()->suspendAnimations(monotonicTime);
+}
+
+void GraphicsLayer::resumeAnimations()
+{
+    platformLayer()->resumeAnimations(monotonicallyIncreasingTime());
+}
+
+PlatformLayer* GraphicsLayer::platformLayer() const
+{
+    return m_transformLayer ? m_transformLayer.get() : m_layer->layer();
+}
+
+static bool copyWebCoreFilterOperationsToWebFilterOperations(const FilterOperations& filters, WebFilterOperations& webFilters)
+{
+    for (size_t i = 0; i < filters.size(); ++i) {
+        const FilterOperation& op = *filters.at(i);
+        switch (op.getOperationType()) {
+        case FilterOperation::REFERENCE:
+            return false; // Not supported.
+        case FilterOperation::GRAYSCALE:
+        case FilterOperation::SEPIA:
+        case FilterOperation::SATURATE:
+        case FilterOperation::HUE_ROTATE: {
+            float amount = static_cast<const BasicColorMatrixFilterOperation*>(&op)->amount();
+            switch (op.getOperationType()) {
+            case FilterOperation::GRAYSCALE:
+                webFilters.append(WebFilterOperation::createGrayscaleFilter(amount));
+                break;
+            case FilterOperation::SEPIA:
+                webFilters.append(WebFilterOperation::createSepiaFilter(amount));
+                break;
+            case FilterOperation::SATURATE:
+                webFilters.append(WebFilterOperation::createSaturateFilter(amount));
+                break;
+            case FilterOperation::HUE_ROTATE:
+                webFilters.append(WebFilterOperation::createHueRotateFilter(amount));
+                break;
+            default:
+                ASSERT_NOT_REACHED();
+            }
+            break;
+        }
+        case FilterOperation::INVERT:
+        case FilterOperation::OPACITY:
+        case FilterOperation::BRIGHTNESS:
+        case FilterOperation::CONTRAST: {
+            float amount = static_cast<const BasicComponentTransferFilterOperation*>(&op)->amount();
+            switch (op.getOperationType()) {
+            case FilterOperation::INVERT:
+                webFilters.append(WebFilterOperation::createInvertFilter(amount));
+                break;
+            case FilterOperation::OPACITY:
+                webFilters.append(WebFilterOperation::createOpacityFilter(amount));
+                break;
+            case FilterOperation::BRIGHTNESS:
+                webFilters.append(WebFilterOperation::createBrightnessFilter(amount));
+                break;
+            case FilterOperation::CONTRAST:
+                webFilters.append(WebFilterOperation::createContrastFilter(amount));
+                break;
+            default:
+                ASSERT_NOT_REACHED();
+            }
+            break;
+        }
+        case FilterOperation::BLUR: {
+            float pixelRadius = static_cast<const BlurFilterOperation*>(&op)->stdDeviation().getFloatValue();
+            webFilters.append(WebFilterOperation::createBlurFilter(pixelRadius));
+            break;
+        }
+        case FilterOperation::DROP_SHADOW: {
+            const DropShadowFilterOperation& dropShadowOp = *static_cast<const DropShadowFilterOperation*>(&op);
+            webFilters.append(WebFilterOperation::createDropShadowFilter(WebPoint(dropShadowOp.x(), dropShadowOp.y()), dropShadowOp.stdDeviation(), dropShadowOp.color().rgb()));
+            break;
+        }
+        case FilterOperation::CUSTOM:
+        case FilterOperation::VALIDATED_CUSTOM:
+            return false; // Not supported.
+        case FilterOperation::PASSTHROUGH:
+        case FilterOperation::NONE:
+            break;
+        }
+    }
+    return true;
+}
+
+bool GraphicsLayer::setFilters(const FilterOperations& filters)
+{
+    // FIXME: For now, we only use SkImageFilters if there is a reference
+    // filter in the chain. Once all issues have been ironed out, we should
+    // switch all filtering over to this path, and remove setFilters() and
+    // WebFilterOperations altogether.
+    if (filters.hasReferenceFilter()) {
+        if (filters.hasCustomFilter()) {
+            // Make sure the filters are removed from the platform layer, as they are
+            // going to fallback to software mode.
+            m_layer->layer()->setFilter(0);
+            m_filters = FilterOperations();
+            return false;
+        }
+        SkiaImageFilterBuilder builder;
+        SkAutoTUnref<SkImageFilter> imageFilter(builder.build(filters));
+        m_layer->layer()->setFilter(imageFilter);
+    } else {
+        WebFilterOperations webFilters;
+        if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters)) {
+            // Make sure the filters are removed from the platform layer, as they are
+            // going to fallback to software mode.
+            m_layer->layer()->setFilters(WebFilterOperations());
+            m_filters = FilterOperations();
+            return false;
+        }
+        m_layer->layer()->setFilters(webFilters);
+    }
+
+    m_filters = filters;
+    return true;
+}
+
+void GraphicsLayer::setBackgroundFilters(const FilterOperations& filters)
+{
+    WebFilterOperations webFilters;
+    if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters))
+        return;
+    m_layer->layer()->setBackgroundFilters(webFilters);
+}
+
+void GraphicsLayer::setLinkHighlight(LinkHighlightClient* linkHighlight)
+{
+    m_linkHighlight = linkHighlight;
+    updateChildList();
 }
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/GraphicsLayer.h b/Source/core/platform/graphics/GraphicsLayer.h
index 6b78dc1..621578d 100644
--- a/Source/core/platform/graphics/GraphicsLayer.h
+++ b/Source/core/platform/graphics/GraphicsLayer.h
@@ -39,14 +39,15 @@
 #include "core/platform/graphics/transforms/TransformOperations.h"
 #include "core/platform/graphics/transforms/TransformationMatrix.h"
 
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+
 #include <public/WebContentLayer.h>
 #include <public/WebImageLayer.h>
 #include <public/WebLayer.h>
 #include <public/WebSolidColorLayer.h>
 
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
 enum LayerTreeAsTextBehaviorFlags {
     LayerTreeAsTextBehaviorNormal = 0,
     LayerTreeAsTextDebug = 1 << 0, // Dump extra debugging info like layer addresses.
@@ -63,7 +64,6 @@
 
 namespace WebCore {
 
-class FloatPoint3D;
 class FloatRect;
 class GraphicsContext;
 class GraphicsLayerFactory;
@@ -75,21 +75,21 @@
 // Base class for animation values (also used for transitions). Here to
 // represent values for properties being animated via the GraphicsLayer,
 // without pulling in style-related data from outside of the platform directory.
+// FIXME: Should be moved to its own header file.
 class AnimationValue {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    AnimationValue(float keyTime, PassRefPtr<TimingFunction> timingFunction = 0)
+    explicit AnimationValue(float keyTime, PassRefPtr<TimingFunction> timingFunction = 0)
         : m_keyTime(keyTime)
+        , m_timingFunction(timingFunction)
     {
-        if (timingFunction)
-            m_timingFunction = timingFunction;
     }
     
     virtual ~AnimationValue() { }
 
     float keyTime() const { return m_keyTime; }
     const TimingFunction* timingFunction() const { return m_timingFunction.get(); }
-    virtual AnimationValue* clone() const = 0;
+    virtual PassOwnPtr<AnimationValue> clone() const = 0;
 
 private:
     float m_keyTime;
@@ -97,6 +97,7 @@
 };
 
 // Used to store one float value of an animation.
+// FIXME: Should be moved to its own header file.
 class FloatAnimationValue : public AnimationValue {
 public:
     FloatAnimationValue(float keyTime, float value, PassRefPtr<TimingFunction> timingFunction = 0)
@@ -104,7 +105,7 @@
         , m_value(value)
     {
     }
-    virtual AnimationValue* clone() const { return new FloatAnimationValue(*this); }
+    virtual PassOwnPtr<AnimationValue> clone() const OVERRIDE { return adoptPtr(new FloatAnimationValue(*this)); }
 
     float value() const { return m_value; }
 
@@ -113,15 +114,16 @@
 };
 
 // Used to store one transform value in a keyframe list.
+// FIXME: Should be moved to its own header file.
 class TransformAnimationValue : public AnimationValue {
 public:
-    TransformAnimationValue(float keyTime, const TransformOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0)
+    explicit TransformAnimationValue(float keyTime, const TransformOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0)
         : AnimationValue(keyTime, timingFunction)
     {
         if (value)
             m_value = *value;
     }
-    virtual AnimationValue* clone() const { return new TransformAnimationValue(*this); }
+    virtual PassOwnPtr<AnimationValue> clone() const OVERRIDE { return adoptPtr(new TransformAnimationValue(*this)); }
 
     const TransformOperations* value() const { return &m_value; }
 
@@ -130,15 +132,16 @@
 };
 
 // Used to store one filter value in a keyframe list.
+// FIXME: Should be moved to its own header file.
 class FilterAnimationValue : public AnimationValue {
 public:
-    FilterAnimationValue(float keyTime, const FilterOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0)
+    explicit FilterAnimationValue(float keyTime, const FilterOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0)
         : AnimationValue(keyTime, timingFunction)
     {
         if (value)
             m_value = *value;
     }
-    virtual AnimationValue* clone() const { return new FilterAnimationValue(*this); }
+    virtual PassOwnPtr<AnimationValue> clone() const OVERRIDE { return adoptPtr(new FilterAnimationValue(*this)); }
 
     const FilterOperations* value() const { return &m_value; }
 
@@ -146,12 +149,12 @@
     FilterOperations m_value;
 };
 
-// Used to store a series of values in a keyframe list. Values will all be of the same type,
-// which can be inferred from the property.
+// Used to store a series of values in a keyframe list.
+// Values will all be of the same type, which can be inferred from the property.
+// FIXME: Should be moved to its own header file.
 class KeyframeValueList {
 public:
-
-    KeyframeValueList(AnimatedPropertyID property)
+    explicit KeyframeValueList(AnimatedPropertyID property)
         : m_property(property)
     {
     }
@@ -163,11 +166,6 @@
             m_values.append(other.m_values[i]->clone());
     }
 
-    ~KeyframeValueList()
-    {
-        deleteAllValues(m_values);
-    }
-
     KeyframeValueList& operator=(const KeyframeValueList& other)
     {
         KeyframeValueList copy(other);
@@ -184,13 +182,13 @@
     AnimatedPropertyID property() const { return m_property; }
 
     size_t size() const { return m_values.size(); }
-    const AnimationValue* at(size_t i) const { return m_values.at(i); }
+    const AnimationValue* at(size_t i) const { return m_values.at(i).get(); }
     
-    // Insert, sorted by keyTime. Takes ownership of the pointer.
-    void insert(const AnimationValue*);
+    // Insert, sorted by keyTime.
+    void insert(PassOwnPtr<const AnimationValue>);
     
 protected:
-    Vector<const AnimationValue*> m_values;
+    Vector<OwnPtr<const AnimationValue> > m_values;
     AnimatedPropertyID m_property;
 };
 
@@ -229,10 +227,10 @@
 
     // Layer name. Only used to identify layers in debug output
     const String& name() const { return m_name; }
-    virtual void setName(const String& name) { m_name = name; }
+    void setName(const String&);
 
     // Layer ID from platform-specific layer. Only used to identify layers in the compositor for debugging purposes.
-    virtual int debugID() const { return DebugIDNoPlatformLayer; }
+    int debugID() const;
 
     GraphicsLayer* parent() const { return m_parent; };
     void setParent(GraphicsLayer*); // Internal use only.
@@ -242,23 +240,23 @@
     
     const Vector<GraphicsLayer*>& children() const { return m_children; }
     // Returns true if the child list changed.
-    virtual bool setChildren(const Vector<GraphicsLayer*>&);
+    bool setChildren(const Vector<GraphicsLayer*>&);
 
     // Add child layers. If the child is already parented, it will be removed from its old parent.
-    virtual void addChild(GraphicsLayer*);
-    virtual void addChildAtIndex(GraphicsLayer*, int index);
-    virtual void addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling);
-    virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling);
-    virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
+    void addChild(GraphicsLayer*);
+    void addChildAtIndex(GraphicsLayer*, int index);
+    void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling);
+    void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling);
+    bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
 
     void removeAllChildren();
-    virtual void removeFromParent();
+    void removeFromParent();
 
     GraphicsLayer* maskLayer() const { return m_maskLayer; }
-    virtual void setMaskLayer(GraphicsLayer* layer) { m_maskLayer = layer; }
+    void setMaskLayer(GraphicsLayer*);
     
     // The given layer will replicate this layer and its children; the replica renders behind this layer.
-    virtual void setReplicatedByLayer(GraphicsLayer*);
+    void setReplicatedByLayer(GraphicsLayer*);
     // Whether this layer is being replicated by another layer.
     bool isReplicated() const { return m_replicaLayer; }
     // The layer that replicates this layer (if any).
@@ -278,154 +276,146 @@
 
     // The position of the layer (the location of its top-left corner in its parent)
     const FloatPoint& position() const { return m_position; }
-    virtual void setPosition(const FloatPoint& p) { m_position = p; }
+    void setPosition(const FloatPoint&);
 
     // Anchor point: (0, 0) is top left, (1, 1) is bottom right. The anchor point
     // affects the origin of the transforms.
     const FloatPoint3D& anchorPoint() const { return m_anchorPoint; }
-    virtual void setAnchorPoint(const FloatPoint3D& p) { m_anchorPoint = p; }
+    void setAnchorPoint(const FloatPoint3D&);
 
     // The size of the layer.
     const FloatSize& size() const { return m_size; }
-    virtual void setSize(const FloatSize& size) { m_size = size; }
+    void setSize(const FloatSize&);
 
     // The boundOrigin affects the offset at which content is rendered, and sublayers are positioned.
     const FloatPoint& boundsOrigin() const { return m_boundsOrigin; }
-    virtual void setBoundsOrigin(const FloatPoint& origin) { m_boundsOrigin = origin; }
+    void setBoundsOrigin(const FloatPoint& origin) { m_boundsOrigin = origin; }
 
     const TransformationMatrix& transform() const { return m_transform; }
-    virtual void setTransform(const TransformationMatrix& t) { m_transform = t; }
+    void setTransform(const TransformationMatrix&);
 
     const TransformationMatrix& childrenTransform() const { return m_childrenTransform; }
-    virtual void setChildrenTransform(const TransformationMatrix& t) { m_childrenTransform = t; }
+    void setChildrenTransform(const TransformationMatrix&);
 
     bool preserves3D() const { return m_preserves3D; }
-    virtual void setPreserves3D(bool b) { m_preserves3D = b; }
+    void setPreserves3D(bool);
     
     bool masksToBounds() const { return m_masksToBounds; }
-    virtual void setMasksToBounds(bool b) { m_masksToBounds = b; }
-    
+    void setMasksToBounds(bool);
+
     bool drawsContent() const { return m_drawsContent; }
-    virtual void setDrawsContent(bool b) { m_drawsContent = b; }
+    void setDrawsContent(bool);
 
     bool contentsAreVisible() const { return m_contentsVisible; }
-    virtual void setContentsVisible(bool b) { m_contentsVisible = b; }
+    void setContentsVisible(bool);
 
     // For special cases, e.g. drawing missing tiles on Android.
     // The compositor should never paint this color in normal cases because the RenderLayer
     // will paint background by itself.
     const Color& backgroundColor() const { return m_backgroundColor; }
-    virtual void setBackgroundColor(const Color&);
+    void setBackgroundColor(const Color&);
 
     // opaque means that we know the layer contents have no alpha
     bool contentsOpaque() const { return m_contentsOpaque; }
-    virtual void setContentsOpaque(bool b) { m_contentsOpaque = b; }
+    void setContentsOpaque(bool);
 
     bool backfaceVisibility() const { return m_backfaceVisibility; }
-    virtual void setBackfaceVisibility(bool b) { m_backfaceVisibility = b; }
+    void setBackfaceVisibility(bool visible);
 
     float opacity() const { return m_opacity; }
-    virtual void setOpacity(float opacity) { m_opacity = opacity; }
+    void setOpacity(float);
 
     const FilterOperations& filters() const { return m_filters; }
     
     // Returns true if filter can be rendered by the compositor
-    virtual bool setFilters(const FilterOperations& filters) { m_filters = filters; return true; }
+    bool setFilters(const FilterOperations&);
+    void setBackgroundFilters(const FilterOperations&);
 
     // Some GraphicsLayers paint only the foreground or the background content
     GraphicsLayerPaintingPhase paintingPhase() const { return m_paintingPhase; }
     void setPaintingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; }
 
-    virtual void setNeedsDisplay() = 0;
+    void setNeedsDisplay();
     // mark the given rect (in layer coords) as needing dispay. Never goes deep.
-    virtual void setNeedsDisplayInRect(const FloatRect&) = 0;
+    void setNeedsDisplayInRect(const FloatRect&);
 
-    virtual void setContentsNeedsDisplay() { };
+    void setContentsNeedsDisplay();
 
     // Set that the position/size of the contents (image or video).
     IntRect contentsRect() const { return m_contentsRect; }
-    virtual void setContentsRect(const IntRect& r) { m_contentsRect = r; }
-    
+    void setContentsRect(const IntRect&);
+
     // Transitions are identified by a special animation name that cannot clash with a keyframe identifier.
     static String animationNameForTransition(AnimatedPropertyID);
     
     // Return true if the animation is handled by the compositing system. If this returns
     // false, the animation will be run by AnimationController.
     // These methods handle both transitions and keyframe animations.
-    virtual bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, const CSSAnimationData*, const String& /*animationName*/, double /*timeOffset*/)  { return false; }
-    virtual void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/) { }
-    virtual void removeAnimation(const String& /*animationName*/) { }
+    bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, const CSSAnimationData*, const String& /*animationName*/, double /*timeOffset*/);
+    void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/);
+    void removeAnimation(const String& /*animationName*/);
 
-    virtual void suspendAnimations(double time);
-    virtual void resumeAnimations();
+    void suspendAnimations(double time);
+    void resumeAnimations();
     
     // Layer contents
-    virtual void setContentsToImage(Image*) { }
-    virtual bool shouldDirectlyCompositeImage(Image*) const { return true; }
-    virtual void setContentsToMedia(PlatformLayer*) { } // video or plug-in
+    void setContentsToImage(Image*);
+    bool shouldDirectlyCompositeImage(Image*) const { return true; }
+    void setContentsToMedia(PlatformLayer*); // video or plug-in
     // Pass an invalid color to remove the contents layer.
-    virtual void setContentsToSolidColor(const Color&) { }
-    virtual void setContentsToCanvas(PlatformLayer*) { }
+    void setContentsToSolidColor(const Color&) { }
+    void setContentsToCanvas(PlatformLayer*);
     // FIXME: webkit.org/b/109658
     // Should unify setContentsToMedia and setContentsToCanvas
-    virtual void setContentsToPlatformLayer(PlatformLayer* layer) { setContentsToMedia(layer); }
-    virtual bool hasContentsLayer() const { return false; }
+    void setContentsToPlatformLayer(PlatformLayer* layer) { setContentsToMedia(layer); }
+    bool hasContentsLayer() const { return m_contentsLayer; }
 
     // Callback from the underlying graphics system to draw layer contents.
     void paintGraphicsLayerContents(GraphicsContext&, const IntRect& clip);
     // Callback from the underlying graphics system when the layer has been displayed
-    virtual void layerDidDisplay(PlatformLayer*) { }
+    void layerDidDisplay(PlatformLayer*) { }
     
     // For hosting this GraphicsLayer in a native layer hierarchy.
-    virtual PlatformLayer* platformLayer() const { return 0; }
-    
+    PlatformLayer* platformLayer() const;
+
     enum CompositingCoordinatesOrientation { CompositingCoordinatesTopDown, CompositingCoordinatesBottomUp };
 
     // Flippedness of the contents of this layer. Does not affect sublayer geometry.
-    virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; }
+    void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; }
     CompositingCoordinatesOrientation contentsOrientation() const { return m_contentsOrientation; }
 
     void dumpLayer(TextStream&, int indent = 0, LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const;
 
-    virtual void setShowDebugBorder(bool show) { m_showDebugBorder = show; }
+    void setShowDebugBorder(bool show) { m_showDebugBorder = show; }
     bool isShowingDebugBorder() const { return m_showDebugBorder; }
 
-    virtual void setShowRepaintCounter(bool show) { m_showRepaintCounter = show; }
+    void setShowRepaintCounter(bool show) { m_showRepaintCounter = show; }
     bool isShowingRepaintCounter() const { return m_showRepaintCounter; }
 
     // FIXME: this is really a paint count.
     int repaintCount() const { return m_repaintCount; }
     int incrementRepaintCount() { return ++m_repaintCount; }
 
-    virtual void setDebugBackgroundColor(const Color&) { }
-    virtual void setDebugBorder(const Color&, float /*borderWidth*/) { }
+    void setDebugBackgroundColor(const Color&) { }
+    void setDebugBorder(const Color&, float /*borderWidth*/) { }
 
     // z-position is the z-equivalent of position(). It's only used for debugging purposes.
-    virtual float zPosition() const { return m_zPosition; }
-    virtual void setZPosition(float);
+    float zPosition() const { return m_zPosition; }
+    void setZPosition(float);
 
-    virtual void distributeOpacity(float);
-    virtual float accumulatedOpacity() const;
-
-    virtual void setMaintainsPixelAlignment(bool maintainsAlignment) { m_maintainsPixelAlignment = maintainsAlignment; }
-    virtual bool maintainsPixelAlignment() const { return m_maintainsPixelAlignment; }
-    
-    float pageScaleFactor() const { return m_client ? m_client->pageScaleFactor() : 1; }
-    float deviceScaleFactor() const { return m_client ? m_client->deviceScaleFactor() : 1; }
-
-    virtual void deviceOrPageScaleFactorChanged() { }
-    void noteDeviceOrPageScaleFactorChangedIncludingDescendants();
+    void distributeOpacity(float);
+    float accumulatedOpacity() const;
 
     // If the exposed rect of this layer changes, returns true if this or descendant layers need a flush,
     // for example to allocate new tiles.
-    virtual bool visibleRectChangeRequiresFlush(const FloatRect& /* clipRect */) const { return false; }
+    bool visibleRectChangeRequiresFlush(const FloatRect& /* clipRect */) const { return false; }
 
     // Return a string with a human readable form of the layer tree, If debug is true
     // pointers for the layers and timing data will be included in the returned string.
     String layerTreeAsText(LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const;
 
     // Return an estimate of the backing store memory cost (in bytes). May be incorrect for tiled layers.
-    virtual double backingStoreMemoryEstimate() const;
+    double backingStoreMemoryEstimate() const;
 
     void resetTrackedRepaints();
     void addRepaintRect(const FloatRect&);
@@ -435,16 +425,28 @@
         return false;
     }
 
+    void setLinkHighlight(LinkHighlightClient*);
+    // Exposed for tests
+    LinkHighlightClient* linkHighlight() { return m_linkHighlight; }
+
+    void setScrollableArea(ScrollableArea* scrollableArea) { m_scrollableArea = scrollableArea; }
+    ScrollableArea* scrollableArea() const { return m_scrollableArea; }
+
+    WebKit::WebContentLayer* contentLayer() const { return m_layer.get(); }
+
+    // Exposed for tests. FIXME - name is too similar to contentLayer(), very error prone.
+    WebKit::WebLayer* contentsLayer() const { return m_contentsLayer; }
+
     void updateDebugIndicators();
 
-    virtual void reportMemoryUsage(MemoryObjectInfo*) const;
+    void reportMemoryUsage(MemoryObjectInfo*) const;
 
     static void registerContentsLayer(WebKit::WebLayer*);
     static void unregisterContentsLayer(WebKit::WebLayer*);
 
 protected:
     // Should be called from derived class destructors. Should call willBeDestroyed() on super.
-    virtual void willBeDestroyed();
+    void willBeDestroyed();
 
     // This method is used by platform GraphicsLayer classes to clear the filters
     // when compositing is not done in hardware. It is not virtual, so the caller
@@ -461,20 +463,18 @@
     // rotations of >= 180 degrees
     static int validateTransformOperations(const KeyframeValueList&, bool& hasBigRotation);
 
-    virtual void setOpacityInternal(float) { }
-
     // The layer being replicated.
     GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; }
-    virtual void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; }
+    void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; }
 
     GraphicsLayer(GraphicsLayerClient*);
 
     static void writeIndent(TextStream&, int indent);
 
     void dumpProperties(TextStream&, int indent, LayerTreeAsTextBehavior) const;
-    virtual void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeAsTextBehavior) const { }
+    void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeAsTextBehavior) const { }
 
-    virtual void getDebugBorderInfo(Color&, float& width) const;
+    void getDebugBorderInfo(Color&, float& width) const;
 
     // Helper functions used by settors to keep layer's the state consistent.
     void updateNames();
@@ -526,7 +526,6 @@
     bool m_masksToBounds : 1;
     bool m_drawsContent : 1;
     bool m_contentsVisible : 1;
-    bool m_maintainsPixelAlignment : 1;
     bool m_showDebugBorder : 1;
     bool m_showRepaintCounter : 1;
     
diff --git a/Source/core/platform/graphics/GraphicsLayerClient.h b/Source/core/platform/graphics/GraphicsLayerClient.h
index c3fcc2e..277deeb 100644
--- a/Source/core/platform/graphics/GraphicsLayerClient.h
+++ b/Source/core/platform/graphics/GraphicsLayerClient.h
@@ -67,11 +67,6 @@
     // initialized to identity already. Returns false if the layer has no transform.
     virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const { return false; }
 
-    // Multiplier for backing store size, related to high DPI.
-    virtual float deviceScaleFactor() const { return 1; }
-    // Page scale factor.
-    virtual float pageScaleFactor() const { return 1; }
-
     virtual bool isTrackingRepaints() const { return false; }
 
 #ifndef NDEBUG
diff --git a/Source/core/platform/graphics/GraphicsTypes.h b/Source/core/platform/graphics/GraphicsTypes.h
index 5460118..079da12 100644
--- a/Source/core/platform/graphics/GraphicsTypes.h
+++ b/Source/core/platform/graphics/GraphicsTypes.h
@@ -30,73 +30,98 @@
 
 namespace WebCore {
 
-    enum CompositeOperator {
-        CompositeClear,
-        CompositeCopy,
-        CompositeSourceOver,
-        CompositeSourceIn,
-        CompositeSourceOut,
-        CompositeSourceAtop,
-        CompositeDestinationOver,
-        CompositeDestinationIn,
-        CompositeDestinationOut,
-        CompositeDestinationAtop,
-        CompositeXOR,
-        CompositePlusDarker,
-        CompositePlusLighter,
-        CompositeDifference
-    };
+enum StrokeStyle {
+    NoStroke,
+    SolidStroke,
+    DottedStroke,
+    DashedStroke,
+#if ENABLE(CSS3_TEXT)
+    DoubleStroke,
+    WavyStroke,
+#endif // CSS3_TEXT
+};
 
-    // keep it in sync with gMapBlendOpsToXfermodeModes array in SkiaUtils.h
-    enum BlendMode {
-        BlendModeNormal,
-        BlendModeMultiply,
-        BlendModeScreen,
-        BlendModeOverlay,
-        BlendModeDarken,
-        BlendModeLighten,
-        BlendModeColorDodge,
-        BlendModeColorBurn,
-        BlendModeHardLight,
-        BlendModeSoftLight,
-        BlendModeDifference,
-        BlendModeExclusion,
-        BlendModeHue,
-        BlendModeSaturation,
-        BlendModeColor,
-        BlendModeLuminosity
-    };
+enum InterpolationQuality {
+    InterpolationDefault,
+    InterpolationNone,
+    InterpolationLow,
+    InterpolationMedium,
+    InterpolationHigh
+};
 
-    enum GradientSpreadMethod {
-        SpreadMethodPad,
-        SpreadMethodReflect,
-        SpreadMethodRepeat
-    };
+enum CompositeOperator {
+    CompositeClear,
+    CompositeCopy,
+    CompositeSourceOver,
+    CompositeSourceIn,
+    CompositeSourceOut,
+    CompositeSourceAtop,
+    CompositeDestinationOver,
+    CompositeDestinationIn,
+    CompositeDestinationOut,
+    CompositeDestinationAtop,
+    CompositeXOR,
+    CompositePlusDarker,
+    CompositePlusLighter,
+    CompositeDifference
+};
 
-    enum LineCap { ButtCap, RoundCap, SquareCap };
+// keep it in sync with gMapBlendOpsToXfermodeModes array in SkiaUtils.h
+enum BlendMode {
+    BlendModeNormal,
+    BlendModeMultiply,
+    BlendModeScreen,
+    BlendModeOverlay,
+    BlendModeDarken,
+    BlendModeLighten,
+    BlendModeColorDodge,
+    BlendModeColorBurn,
+    BlendModeHardLight,
+    BlendModeSoftLight,
+    BlendModeDifference,
+    BlendModeExclusion,
+    BlendModeHue,
+    BlendModeSaturation,
+    BlendModeColor,
+    BlendModeLuminosity
+};
 
-    enum LineJoin { MiterJoin, RoundJoin, BevelJoin };
+enum GradientSpreadMethod {
+    SpreadMethodPad,
+    SpreadMethodReflect,
+    SpreadMethodRepeat
+};
 
-    enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
+enum LineCap { ButtCap, RoundCap, SquareCap };
 
-    enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
-    
-    enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
+enum LineJoin { MiterJoin, RoundJoin, BevelJoin };
 
-    String compositeOperatorName(CompositeOperator, BlendMode);
-    bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, BlendMode&);
+enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
 
-    String lineCapName(LineCap);
-    bool parseLineCap(const String&, LineCap&);
+enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
 
-    String lineJoinName(LineJoin);
-    bool parseLineJoin(const String&, LineJoin&);
+enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
 
-    String textAlignName(TextAlign);
-    bool parseTextAlign(const String&, TextAlign&);
-    
-    String textBaselineName(TextBaseline);
-    bool parseTextBaseline(const String&, TextBaseline&);
+enum TextDrawingMode {
+    TextModeFill      = 1 << 0,
+    TextModeStroke    = 1 << 1,
+};
+typedef unsigned TextDrawingModeFlags;
+
+String compositeOperatorName(CompositeOperator, BlendMode);
+bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, BlendMode&);
+
+String lineCapName(LineCap);
+bool parseLineCap(const String&, LineCap&);
+
+String lineJoinName(LineJoin);
+bool parseLineJoin(const String&, LineJoin&);
+
+String textAlignName(TextAlign);
+bool parseTextAlign(const String&, TextAlign&);
+
+String textBaselineName(TextBaseline);
+bool parseTextBaseline(const String&, TextBaseline&);
 
 } // namespace WebCore
 
diff --git a/Source/core/platform/graphics/MediaPlayer.cpp b/Source/core/platform/graphics/MediaPlayer.cpp
index 09aef77..4b2acf0 100644
--- a/Source/core/platform/graphics/MediaPlayer.cpp
+++ b/Source/core/platform/graphics/MediaPlayer.cpp
@@ -38,7 +38,7 @@
 #include "core/platform/MIMETypeRegistry.h"
 #include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/MediaPlayerPrivate.h"
-#include "modules/mediasource/MediaSource.h"
+#include "modules/mediasource/WebKitMediaSource.h"
 #include <wtf/text/CString.h>
 
 #include "core/platform/graphics/InbandTextTrackPrivate.h"
@@ -47,8 +47,6 @@
 
 namespace WebCore {
 
-const PlatformMedia NoPlatformMedia = { PlatformMedia::None, {0} };
-
 // a null player to make MediaPlayer logic simpler
 
 class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface {
@@ -56,14 +54,13 @@
     NullMediaPlayerPrivate(MediaPlayer*) { }
 
     virtual void load(const String&) { }
-    virtual void load(const String&, PassRefPtr<MediaSource>) { }
+    virtual void load(const String&, PassRefPtr<WebKitMediaSource>) { }
     virtual void cancelLoad() { }
 
     virtual void prepareToPlay() { }
     virtual void play() { }
     virtual void pause() { }    
 
-    virtual PlatformMedia platformMedia() const { return NoPlatformMedia; }
     virtual PlatformLayer* platformLayer() const { return 0; }
 
     virtual IntSize naturalSize() const { return IntSize(0, 0); }
@@ -263,7 +260,7 @@
     return m_currentMediaEngine;
 }
 
-bool MediaPlayer::load(const KURL& url, PassRefPtr<MediaSource> mediaSource)
+bool MediaPlayer::load(const KURL& url, PassRefPtr<WebKitMediaSource> mediaSource)
 {
     m_mediaSource = mediaSource;
     m_contentMIMEType = "";
@@ -447,11 +444,6 @@
     return document && document->isMediaDocument();
 }
 
-PlatformMedia MediaPlayer::platformMedia() const
-{
-    return m_private->platformMedia();
-}
-
 PlatformLayer* MediaPlayer::platformLayer() const
 {
     return m_private->platformLayer();
@@ -862,16 +854,4 @@
     m_private->setTextTrackRepresentation(representation);
 }
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-bool MediaPlayer::implementsTextTrackControls() const
-{
-    return m_private->implementsTextTrackControls();
-}
-
-PassRefPtr<PlatformTextTrackMenuInterface> MediaPlayer::textTrackMenu()
-{
-    return m_private->textTrackMenu();
-}
-#endif // USE(PLATFORM_TEXT_TRACK_MENU)
-
 }
diff --git a/Source/core/platform/graphics/MediaPlayer.h b/Source/core/platform/graphics/MediaPlayer.h
index 537f1c6..874c7d9 100644
--- a/Source/core/platform/graphics/MediaPlayer.h
+++ b/Source/core/platform/graphics/MediaPlayer.h
@@ -38,69 +38,24 @@
 #include <wtf/PassOwnPtr.h>
 #include <wtf/text/StringHash.h>
 
-
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-#include "core/platform/graphics/PlatformTextTrackMenu.h"
-#endif
-
-OBJC_CLASS AVPlayer;
-OBJC_CLASS QTMovie;
-
-class AVCFPlayer;
-class QTMovieGWorld;
-class QTMovieVisualContext;
-
 namespace WebCore {
 
 class AudioSourceProvider;
-class Document;
-class GStreamerGWorld;
-class MediaPlayerPrivateInterface;
-class MediaSource;
-class TextTrackRepresentation;
-
-// Structure that will hold every native
-// types supported by the current media player.
-// We have to do that has multiple media players
-// backend can live at runtime.
-struct PlatformMedia {
-    enum {
-        None,
-        QTMovieType,
-        QTMovieGWorldType,
-        QTMovieVisualContextType,
-        GStreamerGWorldType,
-        ChromiumMediaPlayerType,
-        QtMediaPlayerType,
-        AVFoundationMediaPlayerType,
-        AVFoundationCFMediaPlayerType
-    } type;
-
-    union {
-        QTMovie* qtMovie;
-        QTMovieGWorld* qtMovieGWorld;
-        QTMovieVisualContext* qtMovieVisualContext;
-        GStreamerGWorld* gstreamerGWorld;
-        MediaPlayerPrivateInterface* chromiumMediaPlayer;
-        MediaPlayerPrivateInterface* qtMediaPlayer;
-        AVPlayer* avfMediaPlayer;
-        AVCFPlayer* avcfMediaPlayer;
-    } media;
-};
-
-extern const PlatformMedia NoPlatformMedia;
-
 class CachedResourceLoader;
 class ContentType;
+class Document;
 class FrameView;
 class GraphicsContext;
 class GraphicsContext3D;
+class HostWindow;
 class IntRect;
 class IntSize;
 class MediaPlayer;
-struct MediaPlayerFactory;
+class MediaPlayerPrivateInterface;
+class TextTrackRepresentation;
 class TimeRanges;
-class HostWindow;
+class WebKitMediaSource;
+struct MediaPlayerFactory;
 
 class MediaPlayerClient {
 public:
@@ -221,7 +176,6 @@
     bool supportsFullscreen() const;
     bool supportsSave() const;
     bool supportsScanning() const;
-    PlatformMedia platformMedia() const;
     PlatformLayer* platformLayer() const;
 
     IntSize naturalSize();
@@ -236,7 +190,7 @@
     void setSize(const IntSize& size);
 
     bool load(const KURL&, const ContentType&, const String& keySystem);
-    bool load(const KURL&, PassRefPtr<MediaSource>);
+    bool load(const KURL&, PassRefPtr<WebKitMediaSource>);
     void cancelLoad();
 
     bool visible() const;
@@ -244,7 +198,7 @@
 
     void prepareToPlay();
     void play();
-    void pause();    
+    void pause();
 
 #if ENABLE(ENCRYPTED_MEDIA)
     // Represents synchronous exceptions that can be thrown from the Encrypted Media methods.
@@ -271,7 +225,7 @@
     double rate() const;
     void setRate(double);
 
-    bool preservesPitch() const;    
+    bool preservesPitch() const;
     void setPreservesPitch(bool);
 
     PassRefPtr<TimeRanges> buffered();
@@ -289,7 +243,7 @@
     bool hasClosedCaptions() const;
     void setClosedCaptionsVisible(bool closedCaptionsVisible);
 
-    bool autoplay() const;    
+    bool autoplay() const;
     void setAutoplay(bool);
 
     void paint(GraphicsContext*, const IntRect&);
@@ -398,11 +352,6 @@
     bool requiresTextTrackRepresentation() const;
     void setTextTrackRepresentation(TextTrackRepresentation*);
 
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    bool implementsTextTrackControls() const;
-    PassRefPtr<PlatformTextTrackMenuInterface> textTrackMenu();
-#endif
-
 private:
     MediaPlayer(MediaPlayerClient*);
     void loadWithMediaEngine();
@@ -425,7 +374,7 @@
     bool m_shouldPrepareToRender;
     bool m_contentMIMETypeWasInferredFromExtension;
 
-    RefPtr<MediaSource> m_mediaSource;
+    RefPtr<WebKitMediaSource> m_mediaSource;
 };
 
 typedef PassOwnPtr<MediaPlayerPrivateInterface> (*CreateMediaEnginePlayer)(MediaPlayer*);
diff --git a/Source/core/platform/graphics/MediaPlayerPrivate.h b/Source/core/platform/graphics/MediaPlayerPrivate.h
index 4afdc1b..8e8d6d3 100644
--- a/Source/core/platform/graphics/MediaPlayerPrivate.h
+++ b/Source/core/platform/graphics/MediaPlayerPrivate.h
@@ -34,7 +34,6 @@
 
 class IntRect;
 class IntSize;
-class PlatformTextTrack;
 
 class MediaPlayerPrivateInterface {
     WTF_MAKE_NONCOPYABLE(MediaPlayerPrivateInterface); WTF_MAKE_FAST_ALLOCATED;
@@ -43,11 +42,10 @@
     virtual ~MediaPlayerPrivateInterface() { }
 
     virtual void load(const String& url) = 0;
-    virtual void load(const String& url, PassRefPtr<MediaSource>) = 0;
+    virtual void load(const String& url, PassRefPtr<WebKitMediaSource>) = 0;
     virtual void cancelLoad() = 0;
 
     virtual void prepareToPlay() { }
-    virtual PlatformMedia platformMedia() const { return NoPlatformMedia; }
     virtual PlatformLayer* platformLayer() const { return 0; }
 
     virtual void play() = 0;
@@ -160,12 +158,6 @@
 
     virtual bool requiresTextTrackRepresentation() const { return false; }
     virtual void setTextTrackRepresentation(TextTrackRepresentation*) { }
-
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-    virtual bool implementsTextTrackControls() const { return false; }
-    virtual PassRefPtr<PlatformTextTrackMenuInterface> textTrackMenu() { return 0; }
-#endif
-
 };
 
 }
diff --git a/Source/core/platform/graphics/Path.cpp b/Source/core/platform/graphics/Path.cpp
index 2f07401..4bea6ec 100644
--- a/Source/core/platform/graphics/Path.cpp
+++ b/Source/core/platform/graphics/Path.cpp
@@ -39,38 +39,11 @@
 #include "core/platform/graphics/skia/SkiaUtils.h"
 #include "core/platform/graphics/transforms/AffineTransform.h"
 #include "third_party/skia/include/core/SkPath.h"
+#include "third_party/skia/include/core/SkPathMeasure.h"
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
 
-static void pathLengthApplierFunction(void* info, const PathElement* element)
-{
-    PathTraversalState& traversalState = *static_cast<PathTraversalState*>(info);
-    if (traversalState.m_success)
-        return;
-    FloatPoint* points = element->points;
-    float segmentLength = 0;
-    switch (element->type) {
-        case PathElementMoveToPoint:
-            segmentLength = traversalState.moveTo(points[0]);
-            break;
-        case PathElementAddLineToPoint:
-            segmentLength = traversalState.lineTo(points[0]);
-            break;
-        case PathElementAddQuadCurveToPoint:
-            segmentLength = traversalState.quadraticBezierTo(points[0], points[1]);
-            break;
-        case PathElementAddCurveToPoint:
-            segmentLength = traversalState.cubicBezierTo(points[0], points[1], points[2]);
-            break;
-        case PathElementCloseSubpath:
-            segmentLength = traversalState.closeSubpath();
-            break;
-    }
-    traversalState.m_totalLength += segmentLength; 
-    traversalState.processSegment();
-}
-
 Path::Path()
     : m_path()
 {
@@ -199,27 +172,54 @@
 
 float Path::length() const
 {
-    PathTraversalState traversalState(PathTraversalState::TraversalTotalLength);
-    apply(&traversalState, pathLengthApplierFunction);
-    return traversalState.m_totalLength;
+    SkScalar length = 0;
+    SkPathMeasure measure(m_path, false);
+
+    do {
+        length += measure.getLength();
+    } while (measure.nextContour());
+
+    return SkScalarToFloat(length);
 }
 
 FloatPoint Path::pointAtLength(float length, bool& ok) const
 {
-    PathTraversalState traversalState(PathTraversalState::TraversalPointAtLength);
-    traversalState.m_desiredLength = length;
-    apply(&traversalState, pathLengthApplierFunction);
-    ok = traversalState.m_success;
-    return traversalState.m_current;
+    FloatPoint point;
+    float normal;
+    ok = pointAndNormalAtLength(length, point, normal);
+    return point;
 }
 
 float Path::normalAngleAtLength(float length, bool& ok) const
 {
-    PathTraversalState traversalState(PathTraversalState::TraversalNormalAngleAtLength);
-    traversalState.m_desiredLength = length ? length : std::numeric_limits<float>::epsilon();
-    apply(&traversalState, pathLengthApplierFunction);
-    ok = traversalState.m_success;
-    return traversalState.m_normalAngle;
+    FloatPoint point;
+    float normal;
+    ok = pointAndNormalAtLength(length, point, normal);
+    return normal;
+}
+
+bool Path::pointAndNormalAtLength(float length, FloatPoint& point, float& normal) const
+{
+    SkPathMeasure measure(m_path, false);
+
+    do {
+        SkScalar contourLength = measure.getLength();
+        if (length <= contourLength) {
+            SkVector tangent;
+            SkPoint position;
+
+            if (measure.getPosTan(length, &position, &tangent)) {
+                normal = rad2deg(SkScalarToFloat(SkScalarATan2(tangent.fY, tangent.fX)));
+                point = FloatPoint(SkScalarToFloat(position.fX), SkScalarToFloat(position.fY));
+                return true;
+            }
+        }
+        length -= contourLength;
+    } while (measure.nextContour());
+
+    normal = 0;
+    point = FloatPoint(0, 0);
+    return false;
 }
 
 void Path::clear()
diff --git a/Source/core/platform/graphics/Path.h b/Source/core/platform/graphics/Path.h
index 94a939b..1321c33 100644
--- a/Source/core/platform/graphics/Path.h
+++ b/Source/core/platform/graphics/Path.h
@@ -82,6 +82,7 @@
         float length() const;
         FloatPoint pointAtLength(float length, bool& ok) const;
         float normalAngleAtLength(float length, bool& ok) const;
+        bool pointAndNormalAtLength(float length, FloatPoint&, float&) const;
 
         void clear();
         bool isEmpty() const;
diff --git a/Source/core/platform/graphics/PlatformTextTrack.h b/Source/core/platform/graphics/PlatformTextTrack.h
deleted file mode 100644
index 91e14fb..0000000
--- a/Source/core/platform/graphics/PlatformTextTrack.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PlatformTextTrack_h
-#define PlatformTextTrack_h
-
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class TextTrack;
-class InbandTextTrackPrivate;
-
-class PlatformTextTrackClient {
-public:
-    virtual ~PlatformTextTrackClient() { }
-    
-    virtual TextTrack* publicTrack() = 0;
-    virtual InbandTextTrackPrivate* privateTrack() { return 0; }
-};
-
-class PlatformTextTrack : public RefCounted<PlatformTextTrack> {
-public:
-    enum TrackKind { Subtitle = 0, Caption = 1, Description = 2, Chapter = 3, MetaData = 4 };
-    enum TrackType { InBand = 0, OutOfBand = 1, Script = 2 };
-
-    static PassRefPtr<PlatformTextTrack> create(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type)
-    {
-        return adoptRef(new PlatformTextTrack(client, label, language, kind, type));
-    }
-
-    virtual ~PlatformTextTrack() { }
-    
-    TrackType type() const { return m_type; }
-    TrackKind kind() const { return m_kind; }
-    String label() const { return m_label; }
-    String language() const { return m_language; }
-    PlatformTextTrackClient* client() const { return m_client; }
-    
-protected:
-    PlatformTextTrack(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type)
-        : m_label(label)
-        , m_language(language)
-        , m_kind(kind)
-        , m_type(type)
-        , m_client(client)
-    {
-    }
-
-    String m_label;
-    String m_language;
-    TrackKind m_kind;
-    TrackType m_type;
-    PlatformTextTrackClient* m_client;
-};
-
-}
-
-#endif
-
-#endif // PlatformTextTrack_h
diff --git a/Source/core/platform/graphics/PlatformTextTrackMenu.h b/Source/core/platform/graphics/PlatformTextTrackMenu.h
deleted file mode 100644
index 41602ca..0000000
--- a/Source/core/platform/graphics/PlatformTextTrackMenu.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PlatformTextTrackMenu_h
-#define PlatformTextTrackMenu_h
-
-#if USE(PLATFORM_TEXT_TRACK_MENU)
-
-#include "core/platform/graphics/PlatformTextTrack.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class PlatformTextTrack;
-
-class PlatformTextTrackMenuClient {
-public:
-    virtual ~PlatformTextTrackMenuClient() { }
-    
-    virtual void setSelectedTextTrack(PassRefPtr<PlatformTextTrack>) = 0;
-    virtual Vector<RefPtr<PlatformTextTrack> > platformTextTracks() = 0;
-};
-
-class PlatformTextTrackMenuInterface  : public RefCounted<PlatformTextTrackMenuInterface> {
-public:
-    explicit PlatformTextTrackMenuInterface() { }
-    virtual ~PlatformTextTrackMenuInterface() { }
-
-    virtual void tracksDidChange() = 0;
-    virtual void trackWasSelected(PassRefPtr<PlatformTextTrack>) = 0;
-    virtual void setClient(PlatformTextTrackMenuClient*) = 0;
-};
-
-}
-
-#endif // USE(PLATFORM_TEXT_TRACK_MENU)
-#endif // PlatformTextTrackMenu_h
diff --git a/Source/core/platform/graphics/chromium/AnimationTranslationUtilTest.cpp b/Source/core/platform/graphics/chromium/AnimationTranslationUtilTest.cpp
index 7f64a30..b980418 100644
--- a/Source/core/platform/graphics/chromium/AnimationTranslationUtilTest.cpp
+++ b/Source/core/platform/graphics/chromium/AnimationTranslationUtilTest.cpp
@@ -53,8 +53,8 @@
 {
     const double duration = 1;
     WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
-    values.insert(new FloatAnimationValue(0, 0));
-    values.insert(new FloatAnimationValue(duration, 1));
+    values.insert(adoptPtr(new FloatAnimationValue(0, 0)));
+    values.insert(adoptPtr(new FloatAnimationValue(duration, 1)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -69,11 +69,11 @@
 
     TransformOperations operations1;
     operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -88,11 +88,11 @@
 
     TransformOperations operations1;
     operations1.operations().append(RotateTransformOperation::create(0, TransformOperation::ROTATE));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -106,11 +106,11 @@
     WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
 
     TransformOperations operations1;
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -125,11 +125,11 @@
 
     TransformOperations operations1;
     operations1.operations().append(RotateTransformOperation::create(-330, TransformOperation::ROTATE));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(RotateTransformOperation::create(-320, TransformOperation::ROTATE));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -144,11 +144,11 @@
 
     TransformOperations operations1;
     operations1.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(RotateTransformOperation::create(360, TransformOperation::ROTATE));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -164,13 +164,13 @@
     TransformationMatrix matrix1;
     TransformOperations operations1;
     operations1.operations().append(Matrix3DTransformOperation::create(matrix1));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformationMatrix matrix2;
     matrix2.setM11(0);
     TransformOperations operations2;
     operations2.operations().append(Matrix3DTransformOperation::create(matrix2));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -185,11 +185,11 @@
 
     TransformOperations operations1;
     operations1.operations().append(ScaleTransformOperation::create(1, 1, 1, TransformOperation::SCALE_3D));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(ScaleTransformOperation::create(1, 0, 1, TransformOperation::SCALE_3D));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -204,11 +204,11 @@
 
     TransformOperations operations1;
     operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -224,11 +224,11 @@
 
     TransformOperations operations1;
     operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
@@ -245,11 +245,11 @@
 
     TransformOperations operations1;
     operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
-    values.insert(new TransformAnimationValue(0, &operations1));
+    values.insert(adoptPtr(new TransformAnimationValue(0, &operations1)));
 
     TransformOperations operations2;
     operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
-    values.insert(new TransformAnimationValue(duration, &operations2));
+    values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2)));
 
     RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
     animation->setDuration(duration);
diff --git a/Source/core/platform/graphics/chromium/FontChromiumWin.cpp b/Source/core/platform/graphics/chromium/FontChromiumWin.cpp
index 4ceb73d..1060b14 100644
--- a/Source/core/platform/graphics/chromium/FontChromiumWin.cpp
+++ b/Source/core/platform/graphics/chromium/FontChromiumWin.cpp
@@ -67,7 +67,7 @@
     SkColor color = graphicsContext->effectiveFillColor();
     unsigned char alpha = SkColorGetA(color);
     // Skip 100% transparent text; no need to draw anything.
-    if (!alpha && graphicsContext->strokeStyleSkia() == NoStroke && !graphicsContext->hasShadow())
+    if (!alpha && graphicsContext->strokeStyle() == NoStroke && !graphicsContext->hasShadow())
         return;
 
     // We draw the glyphs in chunks to avoid having to do a heap allocation for
@@ -185,7 +185,7 @@
     SkColor color = graphicsContext->effectiveFillColor();
     unsigned char alpha = SkColorGetA(color);
     // Skip 100% transparent text; no need to draw anything.
-    if (!alpha && graphicsContext->strokeStyleSkia() == NoStroke)
+    if (!alpha && graphicsContext->strokeStyle() == NoStroke)
         return;
 
     HDC hdc = 0;
diff --git a/Source/core/platform/graphics/chromium/GraphicsLayerChromium.cpp b/Source/core/platform/graphics/chromium/GraphicsLayerChromium.cpp
index 2074a52..9363ee5 100644
--- a/Source/core/platform/graphics/chromium/GraphicsLayerChromium.cpp
+++ b/Source/core/platform/graphics/chromium/GraphicsLayerChromium.cpp
@@ -106,462 +106,6 @@
     willBeDestroyed();
 }
 
-void GraphicsLayerChromium::willBeDestroyed()
-{
-    if (m_linkHighlight) {
-        m_linkHighlight->clearCurrentGraphicsLayer();
-        m_linkHighlight = 0;
-    }
-
-    GraphicsLayer::willBeDestroyed();
-}
-
-void GraphicsLayerChromium::setName(const String& inName)
-{
-    m_nameBase = inName;
-    String name = String::format("GraphicsLayer(%p) ", this) + inName;
-    GraphicsLayer::setName(name);
-    updateNames();
-}
-
-int GraphicsLayerChromium::debugID() const
-{
-    return m_layer ? m_layer->layer()->id() : DebugIDNoCompositedLayer;
-}
-
-bool GraphicsLayerChromium::setChildren(const Vector<GraphicsLayer*>& children)
-{
-    m_inSetChildren = true;
-    bool childrenChanged = GraphicsLayer::setChildren(children);
-
-    if (childrenChanged)
-        updateChildList();
-    m_inSetChildren = false;
-
-    return childrenChanged;
-}
-
-void GraphicsLayerChromium::addChild(GraphicsLayer* childLayer)
-{
-    GraphicsLayer::addChild(childLayer);
-    if (!m_inSetChildren)
-        updateChildList();
-}
-
-void GraphicsLayerChromium::addChildAtIndex(GraphicsLayer* childLayer, int index)
-{
-    GraphicsLayer::addChildAtIndex(childLayer, index);
-    updateChildList();
-}
-
-void GraphicsLayerChromium::addChildBelow(GraphicsLayer* childLayer, GraphicsLayer* sibling)
-{
-    GraphicsLayer::addChildBelow(childLayer, sibling);
-    updateChildList();
-}
-
-void GraphicsLayerChromium::addChildAbove(GraphicsLayer* childLayer, GraphicsLayer *sibling)
-{
-    GraphicsLayer::addChildAbove(childLayer, sibling);
-    updateChildList();
-}
-
-bool GraphicsLayerChromium::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild)
-{
-    if (GraphicsLayer::replaceChild(oldChild, newChild)) {
-        updateChildList();
-        return true;
-    }
-    return false;
-}
-
-void GraphicsLayerChromium::removeFromParent()
-{
-    GraphicsLayer::removeFromParent();
-    platformLayer()->removeFromParent();
-}
-
-void GraphicsLayerChromium::setPosition(const FloatPoint& point)
-{
-    GraphicsLayer::setPosition(point);
-    updateLayerPosition();
-}
-
-void GraphicsLayerChromium::setAnchorPoint(const FloatPoint3D& point)
-{
-    GraphicsLayer::setAnchorPoint(point);
-    updateAnchorPoint();
-}
-
-void GraphicsLayerChromium::setSize(const FloatSize& size)
-{
-    // We are receiving negative sizes here that cause assertions to fail in the compositor. Clamp them to 0 to
-    // avoid those assertions.
-    // FIXME: This should be an ASSERT instead, as negative sizes should not exist in WebCore.
-    FloatSize clampedSize = size;
-    if (clampedSize.width() < 0 || clampedSize.height() < 0)
-        clampedSize = FloatSize();
-
-    if (clampedSize == m_size)
-        return;
-
-    GraphicsLayer::setSize(clampedSize);
-    updateLayerSize();
-}
-
-void GraphicsLayerChromium::setTransform(const TransformationMatrix& transform)
-{
-    GraphicsLayer::setTransform(transform);
-    updateTransform();
-}
-
-void GraphicsLayerChromium::setChildrenTransform(const TransformationMatrix& transform)
-{
-    GraphicsLayer::setChildrenTransform(transform);
-    updateChildrenTransform();
-}
-
-void GraphicsLayerChromium::setPreserves3D(bool preserves3D)
-{
-    if (preserves3D == m_preserves3D)
-        return;
-
-    GraphicsLayer::setPreserves3D(preserves3D);
-    updateLayerPreserves3D();
-}
-
-void GraphicsLayerChromium::setMasksToBounds(bool masksToBounds)
-{
-    GraphicsLayer::setMasksToBounds(masksToBounds);
-    updateMasksToBounds();
-}
-
-void GraphicsLayerChromium::setDrawsContent(bool drawsContent)
-{
-    // Note carefully this early-exit is only correct because we also properly call
-    // WebLayer::setDrawsContent whenever m_contentsLayer is set to a new layer in setupContentsLayer().
-    if (drawsContent == m_drawsContent)
-        return;
-
-    GraphicsLayer::setDrawsContent(drawsContent);
-    updateLayerIsDrawable();
-}
-
-void GraphicsLayerChromium::setContentsVisible(bool contentsVisible)
-{
-    // Note carefully this early-exit is only correct because we also properly call
-    // WebLayer::setDrawsContent whenever m_contentsLayer is set to a new layer in setupContentsLayer().
-    if (contentsVisible == m_contentsVisible)
-        return;
-
-    GraphicsLayer::setContentsVisible(contentsVisible);
-    updateLayerIsDrawable();
-}
-
-void GraphicsLayerChromium::setBackgroundColor(const Color& color)
-{
-    if (color == m_backgroundColor)
-        return;
-
-    GraphicsLayer::setBackgroundColor(color);
-    updateLayerBackgroundColor();
-}
-
-void GraphicsLayerChromium::setContentsOpaque(bool opaque)
-{
-    GraphicsLayer::setContentsOpaque(opaque);
-    m_layer->layer()->setOpaque(m_contentsOpaque);
-    m_opaqueRectTrackingContentLayerDelegate->setOpaque(m_contentsOpaque);
-}
-
-static bool copyWebCoreFilterOperationsToWebFilterOperations(const FilterOperations& filters, WebFilterOperations& webFilters)
-{
-    for (size_t i = 0; i < filters.size(); ++i) {
-        const FilterOperation& op = *filters.at(i);
-        switch (op.getOperationType()) {
-        case FilterOperation::REFERENCE:
-            return false; // Not supported.
-        case FilterOperation::GRAYSCALE:
-        case FilterOperation::SEPIA:
-        case FilterOperation::SATURATE:
-        case FilterOperation::HUE_ROTATE: {
-            float amount = static_cast<const BasicColorMatrixFilterOperation*>(&op)->amount();
-            switch (op.getOperationType()) {
-            case FilterOperation::GRAYSCALE:
-                webFilters.append(WebFilterOperation::createGrayscaleFilter(amount));
-                break;
-            case FilterOperation::SEPIA:
-                webFilters.append(WebFilterOperation::createSepiaFilter(amount));
-                break;
-            case FilterOperation::SATURATE:
-                webFilters.append(WebFilterOperation::createSaturateFilter(amount));
-                break;
-            case FilterOperation::HUE_ROTATE:
-                webFilters.append(WebFilterOperation::createHueRotateFilter(amount));
-                break;
-            default:
-                ASSERT_NOT_REACHED();
-            }
-            break;
-        }
-        case FilterOperation::INVERT:
-        case FilterOperation::OPACITY:
-        case FilterOperation::BRIGHTNESS:
-        case FilterOperation::CONTRAST: {
-            float amount = static_cast<const BasicComponentTransferFilterOperation*>(&op)->amount();
-            switch (op.getOperationType()) {
-            case FilterOperation::INVERT:
-                webFilters.append(WebFilterOperation::createInvertFilter(amount));
-                break;
-            case FilterOperation::OPACITY:
-                webFilters.append(WebFilterOperation::createOpacityFilter(amount));
-                break;
-            case FilterOperation::BRIGHTNESS:
-                webFilters.append(WebFilterOperation::createBrightnessFilter(amount));
-                break;
-            case FilterOperation::CONTRAST:
-                webFilters.append(WebFilterOperation::createContrastFilter(amount));
-                break;
-            default:
-                ASSERT_NOT_REACHED();
-            }
-            break;
-        }
-        case FilterOperation::BLUR: {
-            float pixelRadius = static_cast<const BlurFilterOperation*>(&op)->stdDeviation().getFloatValue();
-            webFilters.append(WebFilterOperation::createBlurFilter(pixelRadius));
-            break;
-        }
-        case FilterOperation::DROP_SHADOW: {
-            const DropShadowFilterOperation& dropShadowOp = *static_cast<const DropShadowFilterOperation*>(&op);
-            webFilters.append(WebFilterOperation::createDropShadowFilter(WebPoint(dropShadowOp.x(), dropShadowOp.y()), dropShadowOp.stdDeviation(), dropShadowOp.color().rgb()));
-            break;
-        }
-        case FilterOperation::CUSTOM:
-        case FilterOperation::VALIDATED_CUSTOM:
-            return false; // Not supported.
-        case FilterOperation::PASSTHROUGH:
-        case FilterOperation::NONE:
-            break;
-        }
-    }
-    return true;
-}
-
-bool GraphicsLayerChromium::setFilters(const FilterOperations& filters)
-{
-    // FIXME: For now, we only use SkImageFilters if there is a reference
-    // filter in the chain. Once all issues have been ironed out, we should
-    // switch all filtering over to this path, and remove setFilters() and
-    // WebFilterOperations altogether.
-    if (filters.hasReferenceFilter()) {
-        if (filters.hasCustomFilter()) {
-            // Make sure the filters are removed from the platform layer, as they are
-            // going to fallback to software mode.
-            m_layer->layer()->setFilter(0);
-            GraphicsLayer::setFilters(FilterOperations());
-            return false;
-        }
-        SkiaImageFilterBuilder builder;
-        SkAutoTUnref<SkImageFilter> imageFilter(builder.build(filters));
-        m_layer->layer()->setFilter(imageFilter);
-    } else {
-        WebFilterOperations webFilters;
-        if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters)) {
-            // Make sure the filters are removed from the platform layer, as they are
-            // going to fallback to software mode.
-            m_layer->layer()->setFilters(WebFilterOperations());
-            GraphicsLayer::setFilters(FilterOperations());
-            return false;
-        }
-        m_layer->layer()->setFilters(webFilters);
-    }
-    return GraphicsLayer::setFilters(filters);
-}
-
-void GraphicsLayerChromium::setBackgroundFilters(const FilterOperations& filters)
-{
-    WebFilterOperations webFilters;
-    if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters))
-        return;
-    m_layer->layer()->setBackgroundFilters(webFilters);
-}
-
-void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
-{
-    if (maskLayer == m_maskLayer)
-        return;
-
-    GraphicsLayer::setMaskLayer(maskLayer);
-
-    WebLayer* maskWebLayer = m_maskLayer ? m_maskLayer->platformLayer() : 0;
-    m_layer->layer()->setMaskLayer(maskWebLayer);
-}
-
-void GraphicsLayerChromium::setBackfaceVisibility(bool visible)
-{
-    GraphicsLayer::setBackfaceVisibility(visible);
-    m_layer->setDoubleSided(m_backfaceVisibility);
-}
-
-void GraphicsLayerChromium::setOpacity(float opacity)
-{
-    float clampedOpacity = max(min(opacity, 1.0f), 0.0f);
-    GraphicsLayer::setOpacity(clampedOpacity);
-    platformLayer()->setOpacity(opacity);
-}
-
-void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
-{
-    GraphicsLayerChromium* layerChromium = static_cast<GraphicsLayerChromium*>(layer);
-    GraphicsLayer::setReplicatedByLayer(layer);
-
-    WebLayer* webReplicaLayer = layerChromium ? layerChromium->platformLayer() : 0;
-    platformLayer()->setReplicaLayer(webReplicaLayer);
-}
-
-
-void GraphicsLayerChromium::setContentsNeedsDisplay()
-{
-    if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
-        contentsLayer->invalidate();
-        addRepaintRect(contentsRect());
-    }
-}
-
-void GraphicsLayerChromium::setNeedsDisplay()
-{
-    if (drawsContent()) {
-        m_layer->layer()->invalidate();
-        addRepaintRect(FloatRect(FloatPoint(), m_size));
-        if (m_linkHighlight)
-            m_linkHighlight->invalidate();
-    }
-}
-
-void GraphicsLayerChromium::setNeedsDisplayInRect(const FloatRect& rect)
-{
-    if (drawsContent()) {
-        m_layer->layer()->invalidateRect(rect);
-        addRepaintRect(rect);
-        if (m_linkHighlight)
-            m_linkHighlight->invalidate();
-    }
-}
-
-void GraphicsLayerChromium::setContentsRect(const IntRect& rect)
-{
-    if (rect == m_contentsRect)
-        return;
-
-    GraphicsLayer::setContentsRect(rect);
-    updateContentsRect();
-}
-
-void GraphicsLayerChromium::setContentsToImage(Image* image)
-{
-    bool childrenChanged = false;
-    RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFrame() : 0;
-    if (nativeImage) {
-        if (m_contentsLayerPurpose != ContentsLayerForImage) {
-            m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->createImageLayer());
-            registerContentsLayer(m_imageLayer->layer());
-
-            setupContentsLayer(m_imageLayer->layer());
-            m_contentsLayerPurpose = ContentsLayerForImage;
-            childrenChanged = true;
-        }
-        m_imageLayer->setBitmap(nativeImage->bitmap());
-        m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
-        updateContentsRect();
-    } else {
-        if (m_imageLayer) {
-            childrenChanged = true;
-
-            unregisterContentsLayer(m_imageLayer->layer());
-            m_imageLayer.clear();
-        }
-        // The old contents layer will be removed via updateChildList.
-        m_contentsLayer = 0;
-    }
-
-    if (childrenChanged)
-        updateChildList();
-}
-
-void GraphicsLayerChromium::setContentsToSolidColor(const Color& color)
-{
-}
-
-void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* layer)
-{
-    setContentsTo(ContentsLayerForCanvas, layer);
-}
-
-void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
-{
-    setContentsTo(ContentsLayerForVideo, layer);
-}
-
-bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const CSSAnimationData* animation, const String& animationName, double timeOffset)
-{
-    platformLayer()->setAnimationDelegate(this);
-
-    int animationId = 0;
-
-    if (m_animationIdMap.contains(animationName))
-        animationId = m_animationIdMap.get(animationName);
-
-    OwnPtr<WebAnimation> toAdd(createWebAnimation(values, animation, animationId, timeOffset, boxSize));
-
-    if (toAdd) {
-        animationId = toAdd->id();
-        m_animationIdMap.set(animationName, animationId);
-
-        // Remove any existing animations with the same animation id and target property.
-        platformLayer()->removeAnimation(animationId, toAdd->targetProperty());
-        return platformLayer()->addAnimation(toAdd.get());
-    }
-
-    return false;
-}
-
-void GraphicsLayerChromium::pauseAnimation(const String& animationName, double timeOffset)
-{
-    if (m_animationIdMap.contains(animationName))
-        platformLayer()->pauseAnimation(m_animationIdMap.get(animationName), timeOffset);
-}
-
-void GraphicsLayerChromium::removeAnimation(const String& animationName)
-{
-    if (m_animationIdMap.contains(animationName))
-        platformLayer()->removeAnimation(m_animationIdMap.get(animationName));
-}
-
-void GraphicsLayerChromium::suspendAnimations(double wallClockTime)
-{
-    // |wallClockTime| is in the wrong time base. Need to convert here.
-    // FIXME: find a more reliable way to do this.
-    double monotonicTime = wallClockTime + monotonicallyIncreasingTime() - currentTime();
-    platformLayer()->suspendAnimations(monotonicTime);
-}
-
-void GraphicsLayerChromium::resumeAnimations()
-{
-    platformLayer()->resumeAnimations(monotonicallyIncreasingTime());
-}
-
-void GraphicsLayerChromium::setLinkHighlight(LinkHighlightClient* linkHighlight)
-{
-    m_linkHighlight = linkHighlight;
-    updateChildList();
-}
-
-PlatformLayer* GraphicsLayerChromium::platformLayer() const
-{
-    return m_transformLayer ? m_transformLayer.get() : m_layer->layer();
-}
-
 void GraphicsLayerChromium::paint(GraphicsContext& context, const IntRect& clip)
 {
     paintGraphicsLayerContents(context, clip);
@@ -581,22 +125,7 @@
 void GraphicsLayerChromium::didScroll()
 {
     if (m_scrollableArea)
-        m_scrollableArea->scrollToOffsetWithoutAnimation(IntPoint(m_layer->layer()->scrollPosition()));
-}
-
-void GraphicsLayerChromium::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-{
-    MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Layers);
-    GraphicsLayer::reportMemoryUsage(memoryObjectInfo);
-    info.addMember(m_nameBase, "nameBase");
-    info.addMember(m_layer, "layer");
-    info.addMember(m_transformLayer, "transformLayer");
-    info.addMember(m_imageLayer, "imageLayer");
-    info.addMember(m_contentsLayer, "contentsLayer");
-    info.addMember(m_linkHighlight, "linkHighlight");
-    info.addMember(m_opaqueRectTrackingContentLayerDelegate, "opaqueRectTrackingContentLayerDelegate");
-    info.addMember(m_animationIdMap, "animationIdMap");
-    info.addMember(m_scrollableArea, "scrollableArea");
+        m_scrollableArea->scrollToOffsetWithoutAnimation(m_scrollableArea->minimumScrollPosition() + toIntSize(m_layer->layer()->scrollPosition()));
 }
 
 void GraphicsLayerChromium::setAnimationDelegateForLayer(WebKit::WebLayer* layer)
diff --git a/Source/core/platform/graphics/chromium/GraphicsLayerChromium.h b/Source/core/platform/graphics/chromium/GraphicsLayerChromium.h
index 367d540..13e7a74 100644
--- a/Source/core/platform/graphics/chromium/GraphicsLayerChromium.h
+++ b/Source/core/platform/graphics/chromium/GraphicsLayerChromium.h
@@ -56,74 +56,6 @@
     GraphicsLayerChromium(GraphicsLayerClient*);
     virtual ~GraphicsLayerChromium();
 
-    virtual void willBeDestroyed() OVERRIDE;
-
-    virtual void setName(const String&);
-    virtual int debugID() const;
-
-    virtual bool setChildren(const Vector<GraphicsLayer*>&);
-    virtual void addChild(GraphicsLayer*);
-    virtual void addChildAtIndex(GraphicsLayer*, int index);
-    virtual void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling);
-    virtual void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling);
-    virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
-
-    virtual void removeFromParent();
-
-    virtual void setPosition(const FloatPoint&);
-    virtual void setAnchorPoint(const FloatPoint3D&);
-    virtual void setSize(const FloatSize&);
-
-    virtual void setTransform(const TransformationMatrix&);
-
-    virtual void setChildrenTransform(const TransformationMatrix&);
-
-    virtual void setPreserves3D(bool);
-    virtual void setMasksToBounds(bool);
-    virtual void setDrawsContent(bool);
-    virtual void setContentsVisible(bool);
-    virtual void setMaskLayer(GraphicsLayer*);
-
-    virtual void setBackgroundColor(const Color&);
-
-    virtual void setContentsOpaque(bool);
-    virtual void setBackfaceVisibility(bool);
-
-    virtual void setReplicatedByLayer(GraphicsLayer*);
-
-    virtual void setOpacity(float);
-
-    // Returns true if filter can be rendered by the compositor
-    virtual bool setFilters(const FilterOperations&);
-    void setBackgroundFilters(const FilterOperations&);
-
-    virtual void setNeedsDisplay();
-    virtual void setNeedsDisplayInRect(const FloatRect&);
-    virtual void setContentsNeedsDisplay();
-
-    virtual void setContentsRect(const IntRect&);
-
-    virtual void setContentsToImage(Image*) OVERRIDE;
-    virtual void setContentsToMedia(PlatformLayer*) OVERRIDE;
-    virtual void setContentsToCanvas(PlatformLayer*) OVERRIDE;
-    virtual void setContentsToSolidColor(const Color&) OVERRIDE;
-    virtual bool hasContentsLayer() const { return m_contentsLayer; }
-
-    virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const CSSAnimationData*, const String&, double timeOffset);
-    virtual void pauseAnimation(const String& animationName, double timeOffset);
-    virtual void removeAnimation(const String& animationName);
-    virtual void suspendAnimations(double wallClockTime);
-    virtual void resumeAnimations();
-
-    void setLinkHighlight(LinkHighlightClient*);
-    // Next function for testing purposes.
-    LinkHighlightClient* linkHighlight() { return m_linkHighlight; }
-
-    virtual WebKit::WebLayer* platformLayer() const;
-
-    void setScrollableArea(ScrollableArea* scrollableArea) { m_scrollableArea = scrollableArea; }
-    ScrollableArea* scrollableArea() const { return m_scrollableArea; }
-
     // GraphicsContextPainter implementation.
     virtual void paint(GraphicsContext&, const IntRect& clip) OVERRIDE;
 
@@ -134,13 +66,6 @@
     // WebLayerScrollClient implementation.
     virtual void didScroll() OVERRIDE;
 
-    WebKit::WebContentLayer* contentLayer() const { return m_layer.get(); }
-
-    // Exposed for tests.
-    WebKit::WebLayer* contentsLayer() const { return m_contentsLayer; }
-
-    virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
-
     virtual void setAnimationDelegateForLayer(WebKit::WebLayer*) OVERRIDE;
 };
 
diff --git a/Source/core/platform/graphics/filters/FEColorMatrix.cpp b/Source/core/platform/graphics/filters/FEColorMatrix.cpp
index 6118e53..166fc23 100644
--- a/Source/core/platform/graphics/filters/FEColorMatrix.cpp
+++ b/Source/core/platform/graphics/filters/FEColorMatrix.cpp
@@ -265,7 +265,7 @@
 
     FilterEffect* in = inputEffect(0);
 
-    IntRect imageRect(IntPoint(), absolutePaintRect().size());
+    SkRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect());
 
     SkAutoTUnref<SkColorFilter> filter(createColorFilter(m_type, m_values.data()));
 
@@ -277,7 +277,7 @@
     SkPaint paint;
     paint.setColorFilter(filter);
     paint.setXfermodeMode(SkXfermode::kSrc_Mode);
-    resultImage->context()->drawBitmap(nativeImage->bitmap(), 0, 0, &paint);
+    resultImage->context()->drawBitmap(nativeImage->bitmap(), drawingRegion.fLeft, drawingRegion.fTop, &paint);
     return true;
 }
 
diff --git a/Source/core/platform/graphics/filters/FEDropShadow.cpp b/Source/core/platform/graphics/filters/FEDropShadow.cpp
index b0065ae..a2c5406 100644
--- a/Source/core/platform/graphics/filters/FEDropShadow.cpp
+++ b/Source/core/platform/graphics/filters/FEDropShadow.cpp
@@ -57,18 +57,7 @@
     Filter* filter = this->filter();
     ASSERT(filter);
 
-    FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect();
-    FloatRect absoluteOffsetPaintRect(absolutePaintRect);
-    absoluteOffsetPaintRect.move(filter->applyHorizontalScale(m_dx), filter->applyVerticalScale(m_dy));
-    absolutePaintRect.unite(absoluteOffsetPaintRect);
-    
-    unsigned kernelSizeX = 0;
-    unsigned kernelSizeY = 0;
-    FEGaussianBlur::calculateKernelSize(filter, kernelSizeX, kernelSizeY, m_stdX, m_stdY);
-    
-    // We take the half kernel size and multiply it with three, because we run box blur three times.
-    absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f);
-    absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f);
+    FloatRect absolutePaintRect = mapRect(inputEffect(0)->absolutePaintRect());
 
     if (clipsToBounds())
         absolutePaintRect.intersect(maxEffectRect());
@@ -78,6 +67,29 @@
     setAbsolutePaintRect(enclosingIntRect(absolutePaintRect));
 }
 
+FloatRect FEDropShadow::mapRect(const FloatRect& rect, bool forward)
+{
+    FloatRect result = rect;
+    Filter* filter = this->filter();
+    ASSERT(filter);
+
+    FloatRect offsetRect = rect;
+    if (forward)
+        offsetRect.move(filter->applyHorizontalScale(m_dx), filter->applyVerticalScale(m_dy));
+    else
+        offsetRect.move(-filter->applyHorizontalScale(m_dx), -filter->applyVerticalScale(m_dy));
+    result.unite(offsetRect);
+
+    unsigned kernelSizeX = 0;
+    unsigned kernelSizeY = 0;
+    FEGaussianBlur::calculateKernelSize(filter, kernelSizeX, kernelSizeY, m_stdX, m_stdY);
+
+    // We take the half kernel size and multiply it with three, because we run box blur three times.
+    result.inflateX(3 * kernelSizeX * 0.5f);
+    result.inflateY(3 * kernelSizeY * 0.5f);
+    return result;
+}
+
 void FEDropShadow::applySoftware()
 {
     FilterEffect* in = inputEffect(0);
diff --git a/Source/core/platform/graphics/filters/FEDropShadow.h b/Source/core/platform/graphics/filters/FEDropShadow.h
index 3ca5d83..51ed046 100644
--- a/Source/core/platform/graphics/filters/FEDropShadow.h
+++ b/Source/core/platform/graphics/filters/FEDropShadow.h
@@ -52,6 +52,7 @@
     static float calculateStdDeviation(float);
 
     virtual void determineAbsolutePaintRect();
+    virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
 
     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
 
diff --git a/Source/core/platform/graphics/filters/FEGaussianBlur.cpp b/Source/core/platform/graphics/filters/FEGaussianBlur.cpp
index d73fc9b..0cd65a1 100644
--- a/Source/core/platform/graphics/filters/FEGaussianBlur.cpp
+++ b/Source/core/platform/graphics/filters/FEGaussianBlur.cpp
@@ -260,15 +260,7 @@
 
 void FEGaussianBlur::determineAbsolutePaintRect()
 {
-    unsigned kernelSizeX = 0;
-    unsigned kernelSizeY = 0;
-    calculateKernelSize(filter(), kernelSizeX, kernelSizeY, m_stdX, m_stdY);
-
-    FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect();
-
-    // We take the half kernel size and multiply it with three, because we run box blur three times.
-    absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f);
-    absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f);
+    FloatRect absolutePaintRect = mapRect(inputEffect(0)->absolutePaintRect());
 
     if (clipsToBounds())
         absolutePaintRect.intersect(maxEffectRect());
@@ -278,6 +270,19 @@
     setAbsolutePaintRect(enclosingIntRect(absolutePaintRect));
 }
 
+FloatRect FEGaussianBlur::mapRect(const FloatRect& rect, bool)
+{
+    FloatRect result = rect;
+    unsigned kernelSizeX = 0;
+    unsigned kernelSizeY = 0;
+    calculateKernelSize(filter(), kernelSizeX, kernelSizeY, m_stdX, m_stdY);
+
+    // We take the half kernel size and multiply it with three, because we run box blur three times.
+    result.inflateX(3 * kernelSizeX * 0.5f);
+    result.inflateY(3 * kernelSizeY * 0.5f);
+    return result;
+}
+
 void FEGaussianBlur::applySoftware()
 {
     FilterEffect* in = inputEffect(0);
diff --git a/Source/core/platform/graphics/filters/FEGaussianBlur.h b/Source/core/platform/graphics/filters/FEGaussianBlur.h
index da1dd29..1b9b723 100644
--- a/Source/core/platform/graphics/filters/FEGaussianBlur.h
+++ b/Source/core/platform/graphics/filters/FEGaussianBlur.h
@@ -41,6 +41,7 @@
     static float calculateStdDeviation(float);
 
     virtual void determineAbsolutePaintRect();
+    virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
     static void calculateKernelSize(Filter*, unsigned& kernelSizeX, unsigned& kernelSizeY, float stdX, float stdY);
     static void calculateUnscaledKernelSize(unsigned& kernelSizeX, unsigned& kernelSizeY, float stdX, float stdY);
 
diff --git a/Source/core/platform/graphics/filters/FEMorphology.cpp b/Source/core/platform/graphics/filters/FEMorphology.cpp
index 1bc31ae..9d514fb 100644
--- a/Source/core/platform/graphics/filters/FEMorphology.cpp
+++ b/Source/core/platform/graphics/filters/FEMorphology.cpp
@@ -89,10 +89,7 @@
 
 void FEMorphology::determineAbsolutePaintRect()
 {
-    FloatRect paintRect = inputEffect(0)->absolutePaintRect();
-    Filter* filter = this->filter();
-    paintRect.inflateX(filter->applyHorizontalScale(m_radiusX));
-    paintRect.inflateY(filter->applyVerticalScale(m_radiusY));
+    FloatRect paintRect = mapRect(inputEffect(0)->absolutePaintRect());
     if (clipsToBounds())
         paintRect.intersect(maxEffectRect());
     else
@@ -100,6 +97,14 @@
     setAbsolutePaintRect(enclosingIntRect(paintRect));
 }
 
+FloatRect FEMorphology::mapRect(const FloatRect& rect, bool)
+{
+    FloatRect result = rect;
+    result.inflateX(filter()->applyHorizontalScale(m_radiusX));
+    result.inflateY(filter()->applyVerticalScale(m_radiusY));
+    return result;
+}
+
 bool FEMorphology::setRadiusY(float radiusY)
 {
     if (m_radiusY == radiusY)
diff --git a/Source/core/platform/graphics/filters/FEMorphology.h b/Source/core/platform/graphics/filters/FEMorphology.h
index 7dd3646..ff87b1a 100644
--- a/Source/core/platform/graphics/filters/FEMorphology.h
+++ b/Source/core/platform/graphics/filters/FEMorphology.h
@@ -49,6 +49,7 @@
     virtual SkImageFilter* createImageFilter(SkiaImageFilterBuilder*);
 
     virtual void determineAbsolutePaintRect();
+    virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
 
     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
 
diff --git a/Source/core/platform/graphics/filters/FEOffset.cpp b/Source/core/platform/graphics/filters/FEOffset.cpp
index a64c858..5080e1c 100644
--- a/Source/core/platform/graphics/filters/FEOffset.cpp
+++ b/Source/core/platform/graphics/filters/FEOffset.cpp
@@ -80,6 +80,16 @@
     setAbsolutePaintRect(enclosingIntRect(paintRect));
 }
 
+FloatRect FEOffset::mapRect(const FloatRect& rect, bool forward)
+{
+    FloatRect result = rect;
+    if (forward)
+        result.move(filter()->applyHorizontalScale(m_dx), filter()->applyHorizontalScale(m_dy));
+    else
+        result.move(-filter()->applyHorizontalScale(m_dx), -filter()->applyHorizontalScale(m_dy));
+    return result;
+}
+
 void FEOffset::applySoftware()
 {
     FilterEffect* in = inputEffect(0);
diff --git a/Source/core/platform/graphics/filters/FEOffset.h b/Source/core/platform/graphics/filters/FEOffset.h
index b561f22..daa210f 100644
--- a/Source/core/platform/graphics/filters/FEOffset.h
+++ b/Source/core/platform/graphics/filters/FEOffset.h
@@ -39,6 +39,7 @@
     void setDy(float);
 
     virtual void determineAbsolutePaintRect();
+    virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
 
     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
 
diff --git a/Source/core/platform/graphics/filters/FETile.cpp b/Source/core/platform/graphics/filters/FETile.cpp
index 796c7f8..92ce6a8 100644
--- a/Source/core/platform/graphics/filters/FETile.cpp
+++ b/Source/core/platform/graphics/filters/FETile.cpp
@@ -62,7 +62,7 @@
     FloatPoint maxEffectLocation = maxEffectRect().location();
     if (in->filterEffectType() == FilterEffectTypeSourceInput) {
         Filter* filter = this->filter();
-        tileRect = filter->filterRegion();
+        tileRect = filter->absoluteFilterRegion();
         tileRect.scale(filter->filterResolution().width(), filter->filterResolution().height());
     }
 
diff --git a/Source/core/platform/graphics/filters/Filter.h b/Source/core/platform/graphics/filters/Filter.h
index 51d0bb6..2e66ec7 100644
--- a/Source/core/platform/graphics/filters/Filter.h
+++ b/Source/core/platform/graphics/filters/Filter.h
@@ -42,6 +42,7 @@
     void setFilterResolution(const FloatSize& filterResolution) { m_filterResolution = filterResolution; }
 
     const AffineTransform& absoluteTransform() const { return m_absoluteTransform; }
+    void setAbsoluteTransform(const AffineTransform& absoluteTransform) { m_absoluteTransform = absoluteTransform; }
     FloatPoint mapAbsolutePointToLocalPoint(const FloatPoint& point) const { return m_absoluteTransform.inverse().mapPoint(point); }
 
     RenderingMode renderingMode() const { return m_renderingMode; }
@@ -51,14 +52,20 @@
     virtual float applyVerticalScale(float value) const { return value * m_filterResolution.height(); }
     
     virtual FloatRect sourceImageRect() const = 0;
-    virtual FloatRect filterRegion() const = 0;
-    
+
+    FloatRect absoluteFilterRegion() const { return m_absoluteFilterRegion; }
+    void setAbsoluteFilterRegion(const FloatRect& rect) { m_absoluteFilterRegion = rect; }
+
+    FloatRect filterRegion() const { return m_filterRegion; }
+    void setFilterRegion(const FloatRect& rect) { m_filterRegion = rect; }
 
 private:
     OwnPtr<ImageBuffer> m_sourceImage;
     FloatSize m_filterResolution;
     RenderingMode m_renderingMode;
     AffineTransform m_absoluteTransform;
+    FloatRect m_absoluteFilterRegion;
+    FloatRect m_filterRegion;
 };
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/filters/FilterEffect.cpp b/Source/core/platform/graphics/filters/FilterEffect.cpp
index 920ae25..cded787 100644
--- a/Source/core/platform/graphics/filters/FilterEffect.cpp
+++ b/Source/core/platform/graphics/filters/FilterEffect.cpp
@@ -77,6 +77,45 @@
     
 }
 
+FloatRect FilterEffect::mapRectRecursive(const FloatRect& rect)
+{
+    FloatRect result;
+    if (m_inputEffects.size() > 0) {
+        result = m_inputEffects.at(0)->mapRectRecursive(rect);
+        for (unsigned i = 1; i < m_inputEffects.size(); ++i)
+            result.unite(m_inputEffects.at(i)->mapRectRecursive(rect));
+    } else
+        result = rect;
+    return mapRect(result);
+}
+
+FloatRect FilterEffect::getSourceRect(const FloatRect& destRect, const FloatRect& destClipRect)
+{
+    FloatRect sourceRect = mapRect(destRect, false);
+    FloatRect sourceClipRect = mapRect(destClipRect, false);
+
+    FloatRect boundaries = effectBoundaries();
+    if (hasX())
+        sourceClipRect.setX(boundaries.x());
+    if (hasY())
+        sourceClipRect.setY(boundaries.y());
+    if (hasWidth())
+        sourceClipRect.setWidth(boundaries.width());
+    if (hasHeight())
+        sourceClipRect.setHeight(boundaries.height());
+
+    FloatRect result;
+    if (m_inputEffects.size() > 0) {
+        result = m_inputEffects.at(0)->getSourceRect(sourceRect, sourceClipRect);
+        for (unsigned i = 1; i < m_inputEffects.size(); ++i)
+            result.unite(m_inputEffects.at(i)->getSourceRect(sourceRect, sourceClipRect));
+    } else {
+        result = sourceRect;
+        result.intersect(sourceClipRect);
+    }
+    return result;
+}
+
 IntRect FilterEffect::requestedRegionOfInputImageData(const IntRect& effectRect) const
 {
     ASSERT(hasResult());
@@ -398,4 +437,43 @@
     return ts;
 }
 
+FloatRect FilterEffect::determineFilterPrimitiveSubregion()
+{
+    ASSERT(filter());
+
+    // FETile, FETurbulence, FEFlood don't have input effects, take the filter region as unite rect.
+    FloatRect subregion;
+    if (unsigned numberOfInputEffects = inputEffects().size()) {
+        subregion = inputEffect(0)->determineFilterPrimitiveSubregion();
+        for (unsigned i = 1; i < numberOfInputEffects; ++i)
+            subregion.unite(inputEffect(i)->determineFilterPrimitiveSubregion());
+    } else
+        subregion = filter()->filterRegion();
+
+    // After calling determineFilterPrimitiveSubregion on the target effect, reset the subregion again for <feTile>.
+    if (filterEffectType() == FilterEffectTypeTile)
+        subregion = filter()->filterRegion();
+
+    subregion = mapRect(subregion);
+
+    FloatRect boundaries = effectBoundaries();
+    if (hasX())
+        subregion.setX(boundaries.x());
+    if (hasY())
+        subregion.setY(boundaries.y());
+    if (hasWidth())
+        subregion.setWidth(boundaries.width());
+    if (hasHeight())
+        subregion.setHeight(boundaries.height());
+
+    setFilterPrimitiveSubregion(subregion);
+
+    FloatRect absoluteSubregion = filter()->absoluteTransform().mapRect(subregion);
+    FloatSize filterResolution = filter()->filterResolution();
+    absoluteSubregion.scale(filterResolution.width(), filterResolution.height());
+
+    setMaxEffectRect(absoluteSubregion);
+    return subregion;
+}
+
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/filters/FilterEffect.h b/Source/core/platform/graphics/filters/FilterEffect.h
index 50e5396..cb79746 100644
--- a/Source/core/platform/graphics/filters/FilterEffect.h
+++ b/Source/core/platform/graphics/filters/FilterEffect.h
@@ -104,6 +104,19 @@
 
     virtual void determineAbsolutePaintRect();
 
+    // Mapping a rect forwards determines which which destination pixels a
+    // given source rect would affect. Mapping a rect backwards determines
+    // which pixels from the source rect would be required to fill a given
+    // destination rect. Note that these are not necessarily the inverse of
+    // each other. For example, for FEGaussianBlur, they are the same
+    // transformation.
+    virtual FloatRect mapRect(const FloatRect& rect, bool forward = true) { return rect; }
+    FloatRect mapRectRecursive(const FloatRect&);
+
+    // This is a recursive version of a backwards mapRect(), which also takes
+    // into account the filter primitive subregion of each effect.
+    FloatRect getSourceRect(const FloatRect& destRect, const FloatRect& clipRect);
+
     virtual FilterEffectType filterEffectType() const { return FilterEffectTypeUnknown; }
 
     virtual TextStream& externalRepresentation(TextStream&, int indention = 0) const;
@@ -141,6 +154,8 @@
     virtual void transformResultColorSpace(FilterEffect* in, const int) { in->transformResultColorSpace(m_operatingColorSpace); }
     void transformResultColorSpace(ColorSpace);
 
+    FloatRect determineFilterPrimitiveSubregion();
+
 protected:
     FilterEffect(Filter*);
 
diff --git a/Source/core/platform/graphics/filters/FilterOperations.cpp b/Source/core/platform/graphics/filters/FilterOperations.cpp
index 28ac9f7..8701482 100644
--- a/Source/core/platform/graphics/filters/FilterOperations.cpp
+++ b/Source/core/platform/graphics/filters/FilterOperations.cpp
@@ -108,7 +108,7 @@
 {
     for (size_t i = 0; i < m_operations.size(); ++i) {
         FilterOperation::OperationType operationType = m_operations.at(i).get()->getOperationType();
-        if (operationType == FilterOperation::BLUR || operationType == FilterOperation::DROP_SHADOW)
+        if (operationType == FilterOperation::BLUR || operationType == FilterOperation::DROP_SHADOW || operationType == FilterOperation::REFERENCE)
             return true;
     }
     return false;
@@ -140,6 +140,21 @@
             totalOutsets += outsets;
             break;
         }
+        case FilterOperation::REFERENCE: {
+            ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
+            if (referenceOperation->filterEffect()) {
+                FloatRect outsetRect(0, 0, 1, 1);
+                outsetRect = referenceOperation->filterEffect()->mapRectRecursive(outsetRect);
+                FilterOutsets outsets(
+                    std::max(0.0f, -outsetRect.y()),
+                    std::max(0.0f, outsetRect.x() + outsetRect.width() - 1),
+                    std::max(0.0f, outsetRect.y() + outsetRect.height() - 1),
+                    std::max(0.0f, -outsetRect.x())
+                );
+                totalOutsets += outsets;
+            }
+            break;
+        }
         case FilterOperation::CUSTOM:
         case FilterOperation::VALIDATED_CUSTOM: {
             // FIXME: Need to include the filter margins here.
diff --git a/Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp b/Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp
index 10fe78e..44cf595 100644
--- a/Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp
+++ b/Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp
@@ -91,7 +91,7 @@
         y += SkFloatToScalar(adv[i].height());
     }
 
-    TextDrawingModeFlags textMode = gc->textDrawingModeSkia();
+    TextDrawingModeFlags textMode = gc->textDrawingMode();
 
     // We draw text up to two times (once for fill, once for stroke).
     if (textMode & TextModeFill) {
@@ -114,8 +114,8 @@
     }
 
     if ((textMode & TextModeStroke)
-        && gc->strokeStyleSkia() != NoStroke
-        && gc->strokeThicknessSkia() > 0) {
+        && gc->strokeStyle() != NoStroke
+        && gc->strokeThickness() > 0) {
 
         SkPaint paint;
         gc->setupPaintForStroking(&paint, 0, 0);
@@ -155,11 +155,11 @@
     if (!run.length())
         return;
 
-    TextDrawingModeFlags textMode = gc->textDrawingModeSkia();
+    TextDrawingModeFlags textMode = gc->textDrawingMode();
     bool fill = textMode & TextModeFill;
     bool stroke = (textMode & TextModeStroke)
-        && gc->strokeStyleSkia() != NoStroke
-        && gc->strokeThicknessSkia() > 0;
+        && gc->strokeStyle() != NoStroke
+        && gc->strokeThickness() > 0;
 
     if (!fill && !stroke)
         return;
diff --git a/Source/core/platform/graphics/mac/FontMac.cpp b/Source/core/platform/graphics/mac/FontMac.cpp
index a160edc..f89b76c 100644
--- a/Source/core/platform/graphics/mac/FontMac.cpp
+++ b/Source/core/platform/graphics/mac/FontMac.cpp
@@ -142,7 +142,7 @@
         rotator.setRotate(90);
         rotator.mapPoints(pos, numGlyphs);
     }
-    TextDrawingModeFlags textMode = gc->textDrawingModeSkia();
+    TextDrawingModeFlags textMode = gc->textDrawingMode();
 
     // We draw text up to two times (once for fill, once for stroke).
     if (textMode & TextModeFill) {
@@ -156,8 +156,8 @@
     }
 
     if ((textMode & TextModeStroke)
-        && gc->strokeStyleSkia() != NoStroke
-        && gc->strokeThicknessSkia() > 0) {
+        && gc->strokeStyle() != NoStroke
+        && gc->strokeThickness() > 0) {
 
         SkPaint paint;
         gc->setupPaintForStroking(&paint, 0, 0);
diff --git a/Source/core/platform/graphics/skia/PlatformContextSkiaState.h b/Source/core/platform/graphics/skia/PlatformContextSkiaState.h
deleted file mode 100644
index 4fd0732..0000000
--- a/Source/core/platform/graphics/skia/PlatformContextSkiaState.h
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (C) 2013 Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//    * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//    * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//    * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef PlatformContextSkiaState_h
-#define PlatformContextSkiaState_h
-
-#include "third_party/skia/include/core/SkColorPriv.h"
-#include "third_party/skia/include/effects/SkDashPathEffect.h"
-
-namespace WebCore {
-
-// Encapsulates the additional painting state information we store for each
-// pushed graphics state.
-class PlatformContextSkiaState {
-public:
-    PlatformContextSkiaState()
-        : m_alpha(1)
-        , m_xferMode(SkXfermode::kSrcOver_Mode)
-        , m_useAntialiasing(true)
-        , m_looper(0)
-        , m_fillColor(0xFF000000)
-        , m_strokeStyle(SolidStroke)
-        , m_strokeColor(Color::black)
-        , m_strokeThickness(0)
-        , m_dashRatio(3)
-        , m_miterLimit(4)
-        , m_lineCap(SkPaint::kDefault_Cap)
-        , m_lineJoin(SkPaint::kDefault_Join)
-        , m_dash(0)
-        , m_textDrawingMode(TextModeFill)
-        , m_clip(SkRect::MakeEmpty())
-#if USE(LOW_QUALITY_IMAGE_INTERPOLATION)
-        , m_interpolationQuality(InterpolationLow)
-#else
-        , m_interpolationQuality(InterpolationHigh)
-#endif
-    {
-    }
-
-    PlatformContextSkiaState(const PlatformContextSkiaState& other)
-        : m_alpha(other.m_alpha)
-        , m_xferMode(other.m_xferMode)
-        , m_useAntialiasing(other.m_useAntialiasing)
-        , m_looper(other.m_looper)
-        , m_fillColor(other.m_fillColor)
-        , m_strokeStyle(other.m_strokeStyle)
-        , m_strokeColor(other.m_strokeColor)
-        , m_strokeThickness(other.m_strokeThickness)
-        , m_dashRatio(other.m_dashRatio)
-        , m_miterLimit(other.m_miterLimit)
-        , m_lineCap(other.m_lineCap)
-        , m_lineJoin(other.m_lineJoin)
-        , m_dash(other.m_dash)
-        , m_textDrawingMode(other.m_textDrawingMode)
-        , m_imageBufferClip(other.m_imageBufferClip)
-        , m_clip(other.m_clip)
-        , m_interpolationQuality(other.m_interpolationQuality)
-    {
-        // Up the ref count of these. SkSafeRef does nothing if its argument is 0.
-        SkSafeRef(m_looper);
-        SkSafeRef(m_dash);
-    }
-
-    ~PlatformContextSkiaState()
-    {
-        SkSafeUnref(m_looper);
-        SkSafeUnref(m_dash);
-    }
-
-    // Common shader state.
-    float m_alpha;
-    SkXfermode::Mode m_xferMode;
-    bool m_useAntialiasing;
-    SkDrawLooper* m_looper;
-
-    // Fill.
-    SkColor m_fillColor;
-
-    // Stroke.
-    StrokeStyle m_strokeStyle;
-    SkColor m_strokeColor;
-    float m_strokeThickness;
-    int m_dashRatio;  // Ratio of the length of a dash to its width.
-    float m_miterLimit;
-    SkPaint::Cap m_lineCap;
-    SkPaint::Join m_lineJoin;
-    SkDashPathEffect* m_dash;
-
-    // Text. (See TextModeFill & friends in GraphicsContext.h.)
-    TextDrawingModeFlags m_textDrawingMode;
-
-    // Helper function for applying the state's alpha value to the given input
-    // color to produce a new output color.
-    SkColor applyAlpha(SkColor c) const
-    {
-        int s = roundf(m_alpha * 256);
-        if (s >= 256)
-            return c;
-        if (s < 0)
-            return 0;
-
-        int a = SkAlphaMul(SkColorGetA(c), s);
-        return (c & 0x00FFFFFF) | (a << 24);
-    }
-
-    // If non-empty, the current State is clipped to this image.
-    SkBitmap m_imageBufferClip;
-    // If m_imageBufferClip is non-empty, this is the region the image is clipped to.
-    SkRect m_clip;
-
-    InterpolationQuality m_interpolationQuality;
-
-    // Returns a new State with all of this object's inherited properties copied.
-    PlatformContextSkiaState cloneInheritedProperties() { return PlatformContextSkiaState(*this); }
-
-private:
-    // Not supported.
-    void operator=(const PlatformContextSkiaState&);
-};
-
-} // namespace WebCore
-
-#endif // PlatformContextSkiaState_h
-
diff --git a/Source/core/platform/graphics/skia/SkiaFontWin.cpp b/Source/core/platform/graphics/skia/SkiaFontWin.cpp
index fd5ff7f..f868e79 100644
--- a/Source/core/platform/graphics/skia/SkiaFontWin.cpp
+++ b/Source/core/platform/graphics/skia/SkiaFontWin.cpp
@@ -120,7 +120,7 @@
                           const GOFFSET* offsets,
                           const SkPoint* origin)
 {
-    TextDrawingModeFlags textMode = context->textDrawingModeSkia();
+    TextDrawingModeFlags textMode = context->textDrawingMode();
     // Ensure font load for printing, because PDF device needs it.
     if (context->isPrintingDevice())
         FontPlatformData::ensureFontLoaded(hfont);
@@ -140,8 +140,8 @@
 
     // Stroking on top (if necessary).
     if ((textMode & TextModeStroke)
-        && context->strokeStyleSkia() != NoStroke
-        && context->strokeThicknessSkia() > 0) {
+        && context->strokeStyle() != NoStroke
+        && context->strokeThickness() > 0) {
 
         paint.reset();
         context->setupPaintForStroking(&paint, 0, 0);
diff --git a/Source/core/platform/mac/ScrollAnimatorMac.mm b/Source/core/platform/mac/ScrollAnimatorMac.mm
index 3a3cecc..00135e6 100644
--- a/Source/core/platform/mac/ScrollAnimatorMac.mm
+++ b/Source/core/platform/mac/ScrollAnimatorMac.mm
@@ -666,7 +666,7 @@
         return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
 
     float currentPos = orientation == HorizontalScrollbar ? m_currentPosX : m_currentPosY;
-    float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0);
+    float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), m_scrollableArea->maximumScrollPosition(orientation)), m_scrollableArea->minimumScrollPosition(orientation));
     if (currentPos == newPos)
         return false;
 
@@ -692,8 +692,11 @@
     if (!m_scrollableArea->constrainsScrollingToContentEdge())
         return position;
 
-    float newX = max<float>(min<float>(position.x(), m_scrollableArea->contentsSize().width() - m_scrollableArea->visibleWidth()), 0);
-    float newY = max<float>(min<float>(position.y(), m_scrollableArea->contentsSize().height() - m_scrollableArea->visibleHeight()), 0);
+    IntPoint minPos = m_scrollableArea->minimumScrollPosition();
+    IntPoint maxPos = m_scrollableArea->maximumScrollPosition();
+
+    float newX = max<float>(min<float>(position.x(), maxPos.x()), minPos.x());
+    float newY = max<float>(min<float>(position.y(), maxPos.y()), minPos.y());
 
     return FloatPoint(newX, newY);
 }
diff --git a/Source/core/platform/network/ResourceHandleTypes.h b/Source/core/platform/network/ResourceHandleTypes.h
index 870e795..4dde871 100644
--- a/Source/core/platform/network/ResourceHandleTypes.h
+++ b/Source/core/platform/network/ResourceHandleTypes.h
@@ -33,6 +33,15 @@
     DoNotAllowStoredCredentials
 };
 
+// APIs like XMLHttpRequest and EventSource let the user decide
+// whether to send credentials, but they're always sent for
+// same-origin requests. Additional information is needed to handle
+// cross-origin redirects correctly.
+enum CredentialRequest {
+    ClientRequestedCredentials,
+    ClientDidNotRequestCredentials
+};
+
 } // namespace WebCore
 
 #endif // ResourceHandleTypes_h
diff --git a/Source/core/platform/text/chromium/Hyphenation.cpp b/Source/core/platform/text/Hyphenation.cpp
similarity index 100%
rename from Source/core/platform/text/chromium/Hyphenation.cpp
rename to Source/core/platform/text/Hyphenation.cpp
diff --git a/Source/core/platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp b/Source/core/platform/text/TextBreakIteratorInternalICU.cpp
similarity index 93%
rename from Source/core/platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp
rename to Source/core/platform/text/TextBreakIteratorInternalICU.cpp
index 7d573dd..e70f852 100644
--- a/Source/core/platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp
+++ b/Source/core/platform/text/TextBreakIteratorInternalICU.cpp
@@ -23,9 +23,9 @@
 #include "core/platform/text/TextBreakIteratorInternalICU.h"
 
 #include "core/platform/Language.h"
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/StdLibExtras.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/text/TextChecking.h b/Source/core/platform/text/TextChecking.h
index 17654cc..919515e 100644
--- a/Source/core/platform/text/TextChecking.h
+++ b/Source/core/platform/text/TextChecking.h
@@ -37,18 +37,10 @@
 
 namespace WebCore {
 
-#define WTF_USE_GRAMMAR_CHECKING 1
-
 enum TextCheckingType {
     TextCheckingTypeNone        = 0,
     TextCheckingTypeSpelling    = 1 << 1,
     TextCheckingTypeGrammar     = 1 << 2,
-    TextCheckingTypeLink        = 1 << 5,
-    TextCheckingTypeQuote       = 1 << 6,
-    TextCheckingTypeDash        = 1 << 7,
-    TextCheckingTypeReplacement = 1 << 8,
-    TextCheckingTypeCorrection  = 1 << 9,
-    TextCheckingTypeShowCorrectionPanel = 1 << 10
 };
 
 typedef unsigned TextCheckingTypeMask;
diff --git a/Source/core/rendering/FilterEffectRenderer.cpp b/Source/core/rendering/FilterEffectRenderer.cpp
index 6d6ce15..5fd385d 100644
--- a/Source/core/rendering/FilterEffectRenderer.cpp
+++ b/Source/core/rendering/FilterEffectRenderer.cpp
@@ -50,6 +50,7 @@
 #include "core/rendering/RenderView.h"
 
 #if ENABLE(SVG)
+#include "SVGNames.h"
 #include "core/loader/cache/CachedSVGDocument.h"
 #include "core/loader/cache/CachedSVGDocumentReference.h"
 #include "core/platform/graphics/filters/SourceAlpha.h"
@@ -143,6 +144,11 @@
         return 0;
     }
 
+    if (!filter->isSVGElement() || !filter->hasTagName(SVGNames::filterTag))
+        return 0;
+
+    SVGFilterElement* filterElement = toSVGFilterElement(toSVGElement(filter));
+
     RefPtr<FilterEffect> effect;
 
     // FIXME: Figure out what to do with SourceAlpha. Right now, we're
@@ -152,7 +158,7 @@
     // This may need a spec clarification.
     RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(this));
 
-    for (Node* node = filter->firstChild(); node; node = node->nextSibling()) {
+    for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
         if (!node->isSVGElement())
             continue;
 
@@ -167,6 +173,7 @@
             continue;
 
         effectElement->setStandardAttributes(effect.get());
+        effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits(), sourceImageRect()));
         builder->add(effectElement->result(), effect);
         m_effects.append(effect);
     }
@@ -183,8 +190,6 @@
 {
     m_hasCustomShaderFilter = false;
     m_hasFilterThatMovesPixels = operations.hasFilterThatMovesPixels();
-    if (m_hasFilterThatMovesPixels)
-        m_outsets = operations.outsets();
     
     // Keep the old effects on the stack until we've created the new effects.
     // New FECustomFilters can reuse cached resources from old FECustomFilters.
@@ -351,11 +356,11 @@
         }
 
         if (effect) {
-            // Unlike SVG, filters applied here should not clip to their primitive subregions.
-            effect->setClipsToBounds(false);
             effect->setOperatingColorSpace(ColorSpaceDeviceRGB);
             
             if (filterOperation->getOperationType() != FilterOperation::REFERENCE) {
+                // Unlike SVG, filters applied here should not clip to their primitive subregions.
+                effect->setClipsToBounds(false);
                 effect->inputEffects().append(previousEffect);
                 m_effects.append(effect);
             }
@@ -367,8 +372,6 @@
     if (!m_effects.size())
         return false;
 
-    setMaxEffectRects(m_sourceDrawingRegion);
-    
     return true;
 }
 
@@ -419,15 +422,14 @@
         return filterBoxRect;
     }
     // The result of this function is the area in the "filterBoxRect" that needs to be repainted, so that we fully cover the "dirtyRect".
-    LayoutRect rectForRepaint = dirtyRect;
-    if (hasFilterThatMovesPixels()) {
-        // Note that the outsets are reversed here because we are going backwards -> we have the dirty rect and
-        // need to find out what is the rectangle that might influence the result inside that dirty rect.
-        rectForRepaint.move(-m_outsets.right(), -m_outsets.bottom());
-        rectForRepaint.expand(m_outsets.left() + m_outsets.right(), m_outsets.top() + m_outsets.bottom());
-    }
+    FloatRect rectForRepaint = dirtyRect;
+    rectForRepaint.move(-filterBoxRect.location().x(), -filterBoxRect.location().y());
+    float inf = std::numeric_limits<float>::infinity();
+    FloatRect clipRect = FloatRect(FloatPoint(-inf, -inf), FloatSize(inf, inf));
+    rectForRepaint = lastEffect()->getSourceRect(rectForRepaint, clipRect);
+    rectForRepaint.move(filterBoxRect.location().x(), filterBoxRect.location().y());
     rectForRepaint.intersect(filterBoxRect);
-    return rectForRepaint;
+    return LayoutRect(rectForRepaint);
 }
 
 bool FilterEffectRendererHelper::prepareFilterEffect(RenderLayer* renderLayer, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect)
@@ -438,13 +440,19 @@
 
     FilterEffectRenderer* filter = renderLayer->filterRenderer();
     LayoutRect filterSourceRect = filter->computeSourceImageRectForDirtyRect(filterBoxRect, dirtyRect);
-    m_paintOffset = filterSourceRect.location();
 
     if (filterSourceRect.isEmpty()) {
         // The dirty rect is not in view, just bail out.
         m_haveFilterEffect = false;
         return false;
     }
+
+    AffineTransform absoluteTransform;
+    absoluteTransform.translate(filterBoxRect.x(), filterBoxRect.y());
+    filter->setAbsoluteTransform(absoluteTransform);
+    filter->setAbsoluteFilterRegion(filterSourceRect);
+    filter->setFilterRegion(absoluteTransform.inverse().mapRect(filterSourceRect));
+    filter->lastEffect()->determineFilterPrimitiveSubregion();
     
     bool hasUpdatedBackingStore = filter->updateBackingStoreRect(filterSourceRect);
     if (filter->hasFilterThatMovesPixels()) {
@@ -466,7 +474,7 @@
     filter->allocateBackingStoreIfNeeded();
     // Paint into the context that represents the SourceGraphic of the filter.
     GraphicsContext* sourceGraphicsContext = filter->inputContext();
-    if (!sourceGraphicsContext || !isFilterSizeValid(filter->filterRegion())) {
+    if (!sourceGraphicsContext || !isFilterSizeValid(filter->absoluteFilterRegion())) {
         // Disable the filters and continue.
         m_haveFilterEffect = false;
         return oldContext;
@@ -476,7 +484,10 @@
     
     // Translate the context so that the contents of the layer is captuterd in the offscreen memory buffer.
     sourceGraphicsContext->save();
-    sourceGraphicsContext->translate(-m_paintOffset.x(), -m_paintOffset.y());
+    // FIXME: can we just use sourceImageRect for everything, and get rid of
+    // m_repaintRect?
+    FloatPoint offset = filter->sourceImageRect().location();
+    sourceGraphicsContext->translate(-offset.x(), -offset.y());
     sourceGraphicsContext->clearRect(m_repaintRect);
     sourceGraphicsContext->clip(m_repaintRect);
     
@@ -492,10 +503,7 @@
     filter->apply();
     
     // Get the filtered output and draw it in place.
-    LayoutRect destRect = filter->outputRect();
-    destRect.move(m_paintOffset.x(), m_paintOffset.y());
-    
-    m_savedGraphicsContext->drawImageBuffer(filter->output(), m_renderLayer->renderer()->style()->colorSpace(), pixelSnappedIntRect(destRect), CompositeSourceOver);
+    m_savedGraphicsContext->drawImageBuffer(filter->output(), m_renderLayer->renderer()->style()->colorSpace(), filter->outputRect(), CompositeSourceOver);
     
     filter->clearIntermediateResults();
     
diff --git a/Source/core/rendering/FilterEffectRenderer.h b/Source/core/rendering/FilterEffectRenderer.h
index 89bfdee..eb80830 100644
--- a/Source/core/rendering/FilterEffectRenderer.h
+++ b/Source/core/rendering/FilterEffectRenderer.h
@@ -71,7 +71,7 @@
 private:
     GraphicsContext* m_savedGraphicsContext;
     RenderLayer* m_renderLayer;
-    LayoutPoint m_paintOffset;
+
     LayoutRect m_repaintRect;
     bool m_haveFilterEffect;
 };
@@ -85,18 +85,13 @@
         return adoptRef(new FilterEffectRenderer());
     }
 
-    virtual void setSourceImageRect(const FloatRect& sourceImageRect)
+    void setSourceImageRect(const FloatRect& sourceImageRect)
     { 
         m_sourceDrawingRegion = sourceImageRect;
-        setMaxEffectRects(sourceImageRect);
-        setFilterRegion(sourceImageRect);
         m_graphicsBufferAttached = false;
     }
     virtual FloatRect sourceImageRect() const { return m_sourceDrawingRegion; }
 
-    virtual void setFilterRegion(const FloatRect& filterRegion) { m_filterRegion = filterRegion; }
-    virtual FloatRect filterRegion() const { return m_filterRegion; }
-
     GraphicsContext* inputContext();
     ImageBuffer* output() const { return lastEffect()->asImageBuffer(); }
 
@@ -107,32 +102,24 @@
     void clearIntermediateResults();
     void apply();
     
-    IntRect outputRect() const { return lastEffect()->hasResult() ? lastEffect()->requestedRegionOfInputImageData(IntRect(m_filterRegion)) : IntRect(); }
+    IntRect outputRect() const { return lastEffect()->hasResult() ? lastEffect()->absolutePaintRect() : IntRect(); }
 
     bool hasFilterThatMovesPixels() const { return m_hasFilterThatMovesPixels; }
     LayoutRect computeSourceImageRectForDirtyRect(const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect);
 
     bool hasCustomShaderFilter() const { return m_hasCustomShaderFilter; }
-private:
-    void setMaxEffectRects(const FloatRect& effectRect)
-    {
-        for (size_t i = 0; i < m_effects.size(); ++i) {
-            RefPtr<FilterEffect> effect = m_effects.at(i);
-            effect->setMaxEffectRect(effectRect);
-        }
-    }
     PassRefPtr<FilterEffect> lastEffect() const
     {
         if (m_effects.size() > 0)
             return m_effects.last();
         return 0;
     }
+private:
 
     FilterEffectRenderer();
     virtual ~FilterEffectRenderer();
     
     FloatRect m_sourceDrawingRegion;
-    FloatRect m_filterRegion;
     
     FilterEffectList m_effects;
     RefPtr<SourceGraphic> m_sourceGraphic;
diff --git a/Source/core/rendering/HitTestResult.cpp b/Source/core/rendering/HitTestResult.cpp
index 3f31ff0..7da6a3a 100644
--- a/Source/core/rendering/HitTestResult.cpp
+++ b/Source/core/rendering/HitTestResult.cpp
@@ -24,6 +24,7 @@
 
 #include "HTMLNames.h"
 #include "core/dom/DocumentMarkerController.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/HTMLAnchorElement.h"
@@ -112,16 +113,34 @@
     return *this;
 }
 
-void HitTestResult::setToNonShadowAncestor()
+void HitTestResult::setToNodesInDocumentTreeScope()
 {
-    Node* node = innerNode();
-    if (node)
+    if (Node* node = innerNode()) {
         node = node->document()->ancestorInThisScope(node);
-    setInnerNode(node);
-    node = innerNonSharedNode();
-    if (node)
+        setInnerNode(node);
+    }
+
+    if (Node* node = innerNonSharedNode()) {
         node = node->document()->ancestorInThisScope(node);
-    setInnerNonSharedNode(node);
+        setInnerNonSharedNode(node);
+    }
+}
+
+void HitTestResult::setToShadowHostIfInUserAgentShadowRoot()
+{
+    if (Node* node = innerNode()) {
+        if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) {
+            if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot)
+                setInnerNode(node->shadowHost());
+        }
+    }
+
+    if (Node* node = innerNonSharedNode()) {
+        if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) {
+            if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot)
+                setInnerNonSharedNode(node->shadowHost());
+        }
+    }
 }
 
 void HitTestResult::setInnerNode(Node* n)
@@ -198,20 +217,6 @@
     return marker->description();
 }
 
-String HitTestResult::replacedString() const
-{
-    // Return the replaced string associated with this point, if any. This marker is created when a string is autocorrected, 
-    // and is used for generating a contextual menu item that allows it to easily be changed back if desired.
-    if (!m_innerNonSharedNode)
-        return String();
-    
-    DocumentMarker* marker = m_innerNonSharedNode->document()->markers()->markerContainingPoint(m_hitTestLocation.point(), DocumentMarker::Replacement);
-    if (!marker)
-        return String();
-    
-    return marker->description();
-}    
-    
 String HitTestResult::title(TextDirection& dir) const
 {
     dir = LTR;
diff --git a/Source/core/rendering/HitTestResult.h b/Source/core/rendering/HitTestResult.h
index 019669c..c39102b 100644
--- a/Source/core/rendering/HitTestResult.h
+++ b/Source/core/rendering/HitTestResult.h
@@ -80,7 +80,8 @@
     const LayoutPoint& localPoint() const { return m_localPoint; }
     void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; }
 
-    void setToNonShadowAncestor();
+    void setToNodesInDocumentTreeScope();
+    void setToShadowHostIfInUserAgentShadowRoot();
 
     const HitTestLocation& hitTestLocation() const { return m_hitTestLocation; }
 
@@ -93,7 +94,6 @@
     Frame* targetFrame() const;
     bool isSelected() const;
     String spellingToolTip(TextDirection&) const;
-    String replacedString() const;
     String title(TextDirection&) const;
     String innerTextIfTruncated(TextDirection&) const;
     String altDisplayString() const;
diff --git a/Source/core/rendering/InlineIterator.h b/Source/core/rendering/InlineIterator.h
index 229c4df..85fa6a9 100644
--- a/Source/core/rendering/InlineIterator.h
+++ b/Source/core/rendering/InlineIterator.h
@@ -317,7 +317,8 @@
     ASSERT(m_obj);
     ASSERT(m_obj->isText());
     ASSERT(m_pos <= toRenderText(m_obj)->textLength());
-    m_pos++;
+    if (m_pos < INT_MAX)
+        m_pos++;
 }
 
 // FIXME: This is used by RenderBlock for simplified layout, and has nothing to do with bidi
@@ -523,7 +524,7 @@
             obj = bidiNextSkippingEmptyInlines(m_sor.root(), obj, &isolateTracker);
         }
         if (obj) {
-            unsigned pos = obj == m_eor.m_obj ? m_eor.m_pos : UINT_MAX;
+            unsigned pos = obj == m_eor.m_obj ? m_eor.m_pos : INT_MAX;
             if (obj == endOfLine.m_obj && endOfLine.m_pos <= pos) {
                 m_reachedEndOfLine = true;
                 pos = endOfLine.m_pos;
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
index 23de0a7..e414189 100644
--- a/Source/core/rendering/InlineTextBox.cpp
+++ b/Source/core/rendering/InlineTextBox.cpp
@@ -57,6 +57,8 @@
 typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap;
 static InlineTextBoxOverflowMap* gTextBoxesWithOverflow;
 
+static const int misspellingLineThickness = 3;
+
 void InlineTextBox::destroy(RenderArena* arena)
 {
     if (!knownToHaveNoOverflow() && gTextBoxesWithOverflow)
@@ -1243,10 +1245,6 @@
         return GraphicsContext::DocumentMarkerSpellingLineStyle;
     case DocumentMarker::Grammar:
         return GraphicsContext::DocumentMarkerGrammarLineStyle;
-    case DocumentMarker::CorrectionIndicator:
-        return GraphicsContext::DocumentMarkerAutocorrectionReplacementLineStyle;
-    case DocumentMarker::DictationAlternatives:
-        return GraphicsContext::DocumentMarkerDictationAlternativesLineStyle;
     default:
         ASSERT_NOT_REACHED();
         return GraphicsContext::DocumentMarkerSpellingLineStyle;
@@ -1274,8 +1272,7 @@
     if (m_truncation != cNoTruncation)
         markerSpansWholeBox = false;
 
-    bool isDictationMarker = marker->type() == DocumentMarker::DictationAlternatives;
-    if (!markerSpansWholeBox || grammar || isDictationMarker) {
+    if (!markerSpansWholeBox || grammar) {
         int startPosition = max<int>(marker->startOffset() - m_start, 0);
         int endPosition = min<int>(marker->endOffset() - m_start, m_len);
         
@@ -1295,7 +1292,7 @@
         
         // Store rendered rects for bad grammar markers, so we can hit-test against it elsewhere in order to
         // display a toolTip. We don't do this for misspelling markers.
-        if (grammar || isDictationMarker) {
+        if (grammar) {
             markerRect.move(-boxOrigin.x(), -boxOrigin.y());
             markerRect = renderer()->localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox();
             toRenderedDocumentMarker(marker)->setRenderedRect(markerRect);
@@ -1308,7 +1305,7 @@
     // or decrease the underline thickness.  The overlap is actually the most useful, and matches what AppKit does.
     // So, we generally place the underline at the bottom of the text, but in larger fonts that's not so good so
     // we pin to two pixels under the baseline.
-    int lineThickness = cMisspellingLineThickness;
+    int lineThickness = misspellingLineThickness;
     int baseline = renderer()->style(isFirstLineStyle())->fontMetrics().ascent();
     int descent = logicalHeight() - baseline;
     int underlineOffset;
@@ -1350,23 +1347,6 @@
     }
 }
 
-void InlineTextBox::computeRectForReplacementMarker(DocumentMarker* marker, RenderStyle* style, const Font& font)
-{
-    // Replacement markers are not actually drawn, but their rects need to be computed for hit testing.
-    int top = selectionTop();
-    int h = selectionHeight();
-    
-    int sPos = max(marker->startOffset() - m_start, (unsigned)0);
-    int ePos = min(marker->endOffset() - m_start, (unsigned)m_len);
-    TextRun run = constructTextRun(style, font);
-    IntPoint startPoint = IntPoint(x(), top);
-    
-    // Compute and store the rect associated with this marker.
-    IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, h, sPos, ePos));
-    markerRect = renderer()->localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox();
-    toRenderedDocumentMarker(marker)->setRenderedRect(markerRect);
-}
-    
 void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, const FloatPoint& boxOrigin, RenderStyle* style, const Font& font, bool background)
 {
     if (!renderer()->node())
@@ -1384,9 +1364,6 @@
         switch (marker->type()) {
             case DocumentMarker::Grammar:
             case DocumentMarker::Spelling:
-            case DocumentMarker::CorrectionIndicator:
-            case DocumentMarker::Replacement:
-            case DocumentMarker::DictationAlternatives:
                 if (background)
                     continue;
                 break;
@@ -1410,8 +1387,6 @@
         // marker intersects this run.  Paint it.
         switch (marker->type()) {
             case DocumentMarker::Spelling:
-            case DocumentMarker::CorrectionIndicator:
-            case DocumentMarker::DictationAlternatives:
                 paintDocumentMarker(pt, boxOrigin, marker, style, font, false);
                 break;
             case DocumentMarker::Grammar:
@@ -1420,9 +1395,6 @@
             case DocumentMarker::TextMatch:
                 paintTextMatchMarker(pt, boxOrigin, marker, style, font);
                 break;
-            case DocumentMarker::Replacement:
-                computeRectForReplacementMarker(marker, style, font);
-                break;
             default:
                 ASSERT_NOT_REACHED();
         }
diff --git a/Source/core/rendering/InlineTextBox.h b/Source/core/rendering/InlineTextBox.h
index 8209610..f634f2f 100644
--- a/Source/core/rendering/InlineTextBox.h
+++ b/Source/core/rendering/InlineTextBox.h
@@ -187,7 +187,6 @@
     void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, Color textColor);
     void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar);
     void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&);
-    void computeRectForReplacementMarker(DocumentMarker*, RenderStyle*, const Font&);
 
     TextRun::ExpansionBehavior expansionBehavior() const
     {
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 295e1c4..a40ce9b 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -29,8 +29,8 @@
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/OverflowEvent.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/HTMLFormElement.h"
@@ -1163,6 +1163,47 @@
     anonBlock->destroy();
 }
 
+void RenderBlock::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveInsert)
+{
+    moveAllChildrenTo(toBlock, fullRemoveInsert);
+
+    // When a portion of the render tree is being detached, anonymous blocks
+    // will be combined as their children are deleted. In this process, the
+    // anonymous block later in the tree is merged into the one preceeding it.
+    // It can happen that the later block (this) contains floats that the
+    // previous block (toBlock) did not contain, and thus are not in the
+    // floating objects list for toBlock. This can result in toBlock containing
+    // floats that are not in it's floating objects list, but are in the
+    // floating objects lists of siblings and parents. This can cause problems
+    // when the float itself is deleted, since the deletion code assumes that
+    // if a float is not in it's containing block's floating objects list, it
+    // isn't in any floating objects list. In order to preserve this condition
+    // (removing it has serious performance implications), we need to copy the
+    // floating objects from the old block (this) to the new block (toBlock).
+    // The float's metrics will likely all be wrong, but since toBlock is
+    // already marked for layout, this will get fixed before anything gets
+    // displayed.
+    // See bug https://code.google.com/p/chromium/issues/detail?id=230907
+    if (m_floatingObjects) {
+        if (!toBlock->m_floatingObjects)
+            toBlock->createFloatingObjects();
+
+        const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set();
+        FloatingObjectSetIterator end = fromFloatingObjectSet.end();
+
+        for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it != end; ++it) {
+            FloatingObject* floatingObject = *it;
+
+            // Don't insert the object again if it's already in the list
+            if (toBlock->containsFloat(floatingObject->renderer()))
+                continue;
+
+            toBlock->m_floatingObjects->add(floatingObject->clone());
+        }
+    }
+
+}
+
 void RenderBlock::removeChild(RenderObject* oldChild)
 {
     // No need to waste time in merging or removing empty anonymous blocks.
@@ -1215,7 +1256,7 @@
         } else {
             // Take all the children out of the |next| block and put them in
             // the |prev| block.
-            nextBlock->moveAllChildrenTo(prevBlock, nextBlock->hasLayer() || prevBlock->hasLayer());        
+            nextBlock->moveAllChildrenIncludingFloatsTo(prevBlock, nextBlock->hasLayer() || prevBlock->hasLayer());
             
             // Delete the now-empty block's lines and nuke it.
             nextBlock->deleteLineBoxTree();
diff --git a/Source/core/rendering/RenderBlock.h b/Source/core/rendering/RenderBlock.h
index 17030db..ff84778 100644
--- a/Source/core/rendering/RenderBlock.h
+++ b/Source/core/rendering/RenderBlock.h
@@ -591,6 +591,7 @@
     virtual void removeLeftoverAnonymousBlock(RenderBlock* child);
 
     static void collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* child);
+    void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveInsert);
 
     virtual void dirtyLinesFromChangedChild(RenderObject* child) OVERRIDE FINAL { m_lineBoxes.dirtyLinesFromChangedChild(this, child); }
 
@@ -676,6 +677,18 @@
         {
         }
 
+        FloatingObject* clone() const
+        {
+            FloatingObject* cloneObject = new FloatingObject(type(), m_frameRect);
+            cloneObject->m_renderer = m_renderer;
+            cloneObject->m_originatingLine = m_originatingLine;
+            cloneObject->m_paginationStrut = m_paginationStrut;
+            cloneObject->m_shouldPaint = m_shouldPaint;
+            cloneObject->m_isDescendant = m_isDescendant;
+            cloneObject->m_isPlaced = m_isPlaced;
+            return cloneObject;
+        }
+
         Type type() const { return static_cast<Type>(m_type); }
         RenderBox* renderer() const { return m_renderer; }
         
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp
index 3a56083..d9866af 100644
--- a/Source/core/rendering/RenderBlockLineLayout.cpp
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp
@@ -438,7 +438,7 @@
         if (static_cast<int>(nextMidpoint.m_pos + 1) <= end) {
             lineMidpointState.betweenMidpoints = true;
             lineMidpointState.currentMidpoint++;
-            if (nextMidpoint.m_pos != UINT_MAX) { // UINT_MAX means stop at the object and don't include any of it.
+            if (nextMidpoint.m_pos != INT_MAX) { // INT_MAX means stop at the object and don't include any of it.
                 if (static_cast<int>(nextMidpoint.m_pos + 1) > start)
                     runs.addRun(createRun(start, nextMidpoint.m_pos + 1, obj, resolver));
                 return appendRunsForObject(runs, nextMidpoint.m_pos + 1, end, obj, resolver);
@@ -2522,7 +2522,7 @@
         ASSERT(collapseFirstSpace == CollapseFirstSpace);
         // Add a new end midpoint that stops right at the very end.
         unsigned length = m_whitespace->textLength();
-        unsigned pos = length >= 2 ? length - 2 : UINT_MAX;
+        unsigned pos = length >= 2 ? length - 2 : INT_MAX;
         InlineIterator endMid(0, m_whitespace, pos);
         startIgnoringSpaces(lineMidpointState, endMid);
         for (size_t i = 0; i < m_boxes.size(); ++i) {
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index 3eb551f..3503511 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -186,7 +186,7 @@
         for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) {
             if (curr->isRenderBlock()) {
                 RenderBlock* currBlock = toRenderBlock(curr);
-                if (!parentBlock || parentBlock->isAnonymousBlock() || currBlock->containsFloat(this))
+                if (!parentBlock || currBlock->containsFloat(this))
                     parentBlock = currBlock;
             }
         }
@@ -1750,6 +1750,9 @@
 
 void RenderBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState& transformState) const
 {
+    // We don't expect to be called during layout.
+    ASSERT(!view() || !view()->layoutStateEnabled());
+
     bool isFixedPos = style()->position() == FixedPosition;
     bool hasTransform = hasLayer() && layer()->transform();
     if (hasTransform && !isFixedPos) {
@@ -4066,7 +4069,7 @@
 
 bool RenderBox::avoidsFloats() const
 {
-    return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritingModeRoot() || isDeprecatedFlexItem();
+    return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritingModeRoot() || isFlexItemIncludingDeprecated();
 }
 
 void RenderBox::addVisualEffectOverflow()
diff --git a/Source/core/rendering/RenderBox.h b/Source/core/rendering/RenderBox.h
index ae0b8c8..b05649d 100644
--- a/Source/core/rendering/RenderBox.h
+++ b/Source/core/rendering/RenderBox.h
@@ -505,6 +505,7 @@
     bool isWritingModeRoot() const { return !parent() || parent()->style()->writingMode() != style()->writingMode(); }
 
     bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); }
+    bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDeprecated(); }
     
     virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE;
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index cca8d83..511cfd4 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -514,10 +514,7 @@
         boxShadow = boxShadow->next();
 
     FloatSize shadowOffset(boxShadow->x(), boxShadow->y());
-    if (!boxShadow->isWebkitBoxShadow())
-        context->setShadow(shadowOffset, boxShadow->blur(), boxShadow->color(), style->colorSpace());
-    else
-        context->setLegacyShadow(shadowOffset, boxShadow->blur(), boxShadow->color(), style->colorSpace());
+    context->setShadow(shadowOffset, boxShadow->blur(), boxShadow->color(), style->colorSpace());
 }
 
 void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const LayoutRect& rect,
@@ -2379,11 +2376,7 @@
             IntSize extraOffset(paintRect.pixelSnappedWidth() + max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0);
             shadowOffset -= extraOffset;
             fillRect.move(extraOffset);
-
-            if (shadow->isWebkitBoxShadow())
-                context->setLegacyShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
-            else
-                context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
+            context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
 
             if (hasBorderRadius) {
                 RoundedRect rectToClipOut = border;
@@ -2473,12 +2466,7 @@
             IntSize extraOffset(2 * paintRect.pixelSnappedWidth() + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);
             context->translate(extraOffset.width(), extraOffset.height());
             shadowOffset -= extraOffset;
-
-            if (shadow->isWebkitBoxShadow())
-                context->setLegacyShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
-            else
-                context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
-
+            context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
             context->fillRectWithRoundedHole(outerRect, roundedHole, fillColor, s->colorSpace());
         }
     }
@@ -2600,6 +2588,9 @@
 
 void RenderBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState& transformState) const
 {
+    // We don't expect to be called during layout.
+    ASSERT(!view() || !view()->layoutStateEnabled());
+
     RenderObject* o = container();
     if (!o)
         return;
diff --git a/Source/core/rendering/RenderFileUploadControl.cpp b/Source/core/rendering/RenderFileUploadControl.cpp
index a96c855..a8dc63f 100644
--- a/Source/core/rendering/RenderFileUploadControl.cpp
+++ b/Source/core/rendering/RenderFileUploadControl.cpp
@@ -23,8 +23,8 @@
 
 #include <math.h>
 #include "HTMLNames.h"
-#include "core/dom/ElementShadow.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/VisiblePosition.h"
 #include "core/fileapi/FileList.h"
 #include "core/html/HTMLInputElement.h"
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index 3700d2a..885fac5 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -66,6 +66,28 @@
     LayoutUnit m_maxBreadth;
 };
 
+struct GridTrackForNormalization {
+    GridTrackForNormalization(const GridTrack& track, double flex)
+        : m_track(&track)
+        , m_flex(flex)
+        , m_normalizedFlexValue(track.m_usedBreadth / flex)
+    {
+    }
+
+    // Required by std::sort.
+    GridTrackForNormalization operator=(const GridTrackForNormalization& o)
+    {
+        m_track = o.m_track;
+        m_flex = o.m_flex;
+        m_normalizedFlexValue = o.m_normalizedFlexValue;
+        return *this;
+    }
+
+    const GridTrack* m_track;
+    double m_flex;
+    LayoutUnit m_normalizedFlexValue;
+};
+
 class RenderGrid::GridIterator {
     WTF_MAKE_NONCOPYABLE(GridIterator);
 public:
@@ -231,7 +253,6 @@
 
 LayoutUnit RenderGrid::computePreferredTrackWidth(const GridLength& gridLength, size_t trackIndex) const
 {
-    // FIXME: Implement support for <flex> (crbug.com/235258)
     if (gridLength.isFlex())
         return 0;
 
@@ -278,7 +299,7 @@
         const GridLength& maxTrackBreadth = trackSize.maxTrackBreadth();
 
         track.m_usedBreadth = computeUsedBreadthOfMinLength(direction, minTrackBreadth);
-        track.m_maxBreadth = computeUsedBreadthOfMaxLength(direction, maxTrackBreadth);
+        track.m_maxBreadth = computeUsedBreadthOfMaxLength(direction, maxTrackBreadth, track.m_usedBreadth);
 
         track.m_maxBreadth = std::max(track.m_maxBreadth, track.m_usedBreadth);
     }
@@ -295,6 +316,18 @@
         tracksForDistribution[i] = tracks.data() + i;
 
     distributeSpaceToTracks(tracksForDistribution, 0, &GridTrack::usedBreadth, &GridTrack::growUsedBreadth, availableLogicalSpace);
+
+    // 4. Grow all Grid tracks having a fraction as the MaxTrackSizingFunction.
+
+    // FIXME: Handle the case where RemainingSpace is not defined.
+    double normalizedFractionBreadth = computeNormalizedFractionBreadth(tracks, direction, availableLogicalSpace);
+    for (size_t i = 0; i < tracksSize; ++i) {
+        const GridTrackSize& trackSize = gridTrackSize(direction, i);
+        if (!trackSize.maxTrackBreadth().isFlex())
+            continue;
+
+        tracks[i].m_usedBreadth = std::max<LayoutUnit>(tracks[i].m_usedBreadth, normalizedFractionBreadth * trackSize.maxTrackBreadth().flex());
+    }
 }
 
 LayoutUnit RenderGrid::computeUsedBreadthOfMinLength(TrackSizingDirection direction, const GridLength& gridLength) const
@@ -311,12 +344,10 @@
     return 0;
 }
 
-LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(TrackSizingDirection direction, const GridLength& gridLength) const
+LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(TrackSizingDirection direction, const GridLength& gridLength, LayoutUnit usedBreadth) const
 {
-    if (gridLength.isFlex()) {
-        // FIXME: We should return the UsedBreadth per the specification.
-        return 0;
-    }
+    if (gridLength.isFlex())
+        return usedBreadth;
 
     const Length& trackLength = gridLength.length();
     ASSERT(!trackLength.isAuto());
@@ -339,6 +370,56 @@
     return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(style()->logicalHeight(), -1), view());
 }
 
+static bool sortByGridNormalizedFlexValue(const GridTrackForNormalization& track1, const GridTrackForNormalization& track2)
+{
+    return track1.m_normalizedFlexValue < track2.m_normalizedFlexValue;
+}
+
+double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, TrackSizingDirection direction, LayoutUnit availableLogicalSpace) const
+{
+    // |availableLogicalSpace| already accounts for the used breadths so no need to remove it here.
+
+    Vector<GridTrackForNormalization> tracksForNormalization;
+    for (size_t i = 0; i < tracks.size(); ++i) {
+        const GridTrackSize& trackSize = gridTrackSize(direction, i);
+        if (!trackSize.maxTrackBreadth().isFlex())
+            continue;
+
+        tracksForNormalization.append(GridTrackForNormalization(tracks[i], trackSize.maxTrackBreadth().flex()));
+    }
+
+    // FIXME: Ideally we shouldn't come here without any <flex> grid track.
+    if (tracksForNormalization.isEmpty())
+        return LayoutUnit();
+
+    std::sort(tracksForNormalization.begin(), tracksForNormalization.end(), sortByGridNormalizedFlexValue);
+
+    // These values work together: as we walk over our grid tracks, we increase fractionValueBasedOnGridItemsRatio
+    // to match a grid track's usedBreadth to <flex> ratio until the total fractions sized grid tracks wouldn't
+    // fit into availableLogicalSpaceIgnoringFractionTracks.
+    double accumulatedFractions = 0;
+    LayoutUnit fractionValueBasedOnGridItemsRatio = 0;
+    LayoutUnit availableLogicalSpaceIgnoringFractionTracks = availableLogicalSpace;
+
+    for (size_t i = 0; i < tracksForNormalization.size(); ++i) {
+        const GridTrackForNormalization& track = tracksForNormalization[i];
+        if (track.m_normalizedFlexValue > fractionValueBasedOnGridItemsRatio) {
+            // If the normalized flex value (we ordered |tracksForNormalization| by increasing normalized flex value)
+            // will make us overflow our container, then stop. We have the previous step's ratio is the best fit.
+            if (track.m_normalizedFlexValue * accumulatedFractions > availableLogicalSpaceIgnoringFractionTracks)
+                break;
+
+            fractionValueBasedOnGridItemsRatio = track.m_normalizedFlexValue;
+        }
+
+        accumulatedFractions += track.m_flex;
+        // This item was processed so we re-add its used breadth to the available space to accurately count the remaining space.
+        availableLogicalSpaceIgnoringFractionTracks += track.m_track->m_usedBreadth;
+    }
+
+    return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions;
+}
+
 const GridTrackSize& RenderGrid::gridTrackSize(TrackSizingDirection direction, size_t i) const
 {
     const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows();
@@ -428,7 +509,7 @@
 
 void RenderGrid::resolveContentBasedTrackSizingFunctions(TrackSizingDirection direction, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, LayoutUnit& availableLogicalSpace)
 {
-    // FIXME: Split the grid tracks once we support fractions (step 1 of the algorithm).
+    // FIXME: Split the grid tracks into groups that doesn't overlap a <flex> grid track (crbug.com/235258).
 
     Vector<GridTrack>& tracks = (direction == ForColumns) ? columnTracks : rowTracks;
 
@@ -491,7 +572,8 @@
         GridTrack& track = *tracks[i];
         LayoutUnit availableLogicalSpaceShare = availableLogicalSpace / (tracksSize - i);
         LayoutUnit trackBreadth = (tracks[i]->*trackGetter)();
-        LayoutUnit growthShare = std::min(availableLogicalSpaceShare, track.m_maxBreadth - trackBreadth);
+        LayoutUnit growthShare = std::max(LayoutUnit(), std::min(availableLogicalSpaceShare, track.m_maxBreadth - trackBreadth));
+        // We should never shrink any grid track or else we can't guarantee we abide by our min-sizing function.
         updatedTrackBreadths[i] = trackBreadth + growthShare;
         availableLogicalSpace -= growthShare;
     }
diff --git a/Source/core/rendering/RenderGrid.h b/Source/core/rendering/RenderGrid.h
index 61b9825..af328ae 100644
--- a/Source/core/rendering/RenderGrid.h
+++ b/Source/core/rendering/RenderGrid.h
@@ -90,7 +90,7 @@
     enum TrackSizingDirection { ForColumns, ForRows };
     void computedUsedBreadthOfGridTracks(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks);
     LayoutUnit computeUsedBreadthOfMinLength(TrackSizingDirection, const GridLength&) const;
-    LayoutUnit computeUsedBreadthOfMaxLength(TrackSizingDirection, const GridLength&) const;
+    LayoutUnit computeUsedBreadthOfMaxLength(TrackSizingDirection, const GridLength&, LayoutUnit usedBreadth) const;
     LayoutUnit computeUsedBreadthOfSpecifiedLength(TrackSizingDirection, const Length&) const;
     void resolveContentBasedTrackSizingFunctions(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, LayoutUnit& availableLogicalSpace);
 
@@ -114,6 +114,8 @@
     void resolveContentBasedTrackSizingFunctionsForItems(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, RenderBox*, FilterFunction, SizingFunction, AccumulatorGetter, AccumulatorGrowFunction);
     void distributeSpaceToTracks(Vector<GridTrack*>&, Vector<GridTrack*>* tracksForGrowthAboveMaxBreadth, AccumulatorGetter, AccumulatorGrowFunction, LayoutUnit& availableLogicalSpace);
 
+    double computeNormalizedFractionBreadth(Vector<GridTrack>&, TrackSizingDirection, LayoutUnit availableLogicalSpace) const;
+
     const GridTrackSize& gridTrackSize(TrackSizingDirection, size_t) const;
     size_t explicitGridColumnCount() const;
     size_t explicitGridRowCount() const;
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 76a2ed8..b8d9560 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -51,8 +51,8 @@
 #include "core/dom/Document.h"
 #include "core/dom/DocumentEventQueue.h"
 #include "core/dom/OverflowEvent.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/HTMLFrameElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
@@ -2202,10 +2202,10 @@
 {
     IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(scrollOffset) : scrollOffset;
     if (newScrollOffset != adjustedScrollOffset())
-        scrollToOffsetWithoutAnimation(IntPoint(newScrollOffset));
+        scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset);
 }
 
-void RenderLayer::scrollTo(int x, int y)
+void RenderLayer::setScrollOffset(const IntPoint& newScrollOffset)
 {
     RenderBox* box = renderBox();
     if (!box)
@@ -2217,15 +2217,9 @@
             computeScrollDimensions();
     }
     
-    // FIXME: Eventually, we will want to perform a blit.  For now never
-    // blit, since the check for blitting is going to be very
-    // complicated (since it will involve testing whether our layer
-    // is either occluded by another layer or clipped by an enclosing
-    // layer or contains fixed backgrounds, etc.).
-    IntSize newScrollOffset = IntSize(x - scrollOrigin().x(), y - scrollOrigin().y());
-    if (m_scrollOffset == newScrollOffset)
+    if (m_scrollOffset == toIntSize(newScrollOffset))
         return;
-    m_scrollOffset = newScrollOffset;
+    m_scrollOffset = toIntSize(newScrollOffset);
 
     Frame* frame = renderer()->frame();
     InspectorInstrumentation::willScrollLayer(frame);
@@ -2581,11 +2575,6 @@
     return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0;
 }
 
-void RenderLayer::setScrollOffset(const IntPoint& offset)
-{
-    scrollTo(offset.x(), offset.y());
-}
-
 int RenderLayer::scrollPosition(Scrollbar* scrollbar) const
 {
     if (scrollbar->orientation() == HorizontalScrollbar)
@@ -2607,8 +2596,13 @@
 
 IntPoint RenderLayer::maximumScrollPosition() const
 {
-    // FIXME: m_scrollSize may not be up-to-date if m_scrollDimensionsDirty is true.
-    return -scrollOrigin() + roundedIntSize(m_scrollSize) - visibleContentRect(IncludeScrollbars).size();
+    RenderBox* box = renderBox();
+    if (!box)
+        return -scrollOrigin();
+
+    LayoutRect overflowRect(box->layoutOverflowRect());
+    box->flipForWritingMode(overflowRect);
+    return -scrollOrigin() + enclosingIntRect(overflowRect).size() - enclosingIntRect(box->clientBoxRect()).size();
 }
 
 IntRect RenderLayer::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
@@ -3250,7 +3244,7 @@
     updateScrollbarsAfterLayout();
 
     if (originalScrollOffset != adjustedScrollOffset())
-        scrollToOffsetWithoutAnimation(IntPoint(adjustedScrollOffset()));
+        scrollToOffsetWithoutAnimation(-scrollOrigin() + adjustedScrollOffset());
 
     // Composited scrolling may need to be enabled or disabled if the amount of overflow changed.
     if (renderer()->view() && compositor()->updateLayerCompositingState(this))
diff --git a/Source/core/rendering/RenderLayer.h b/Source/core/rendering/RenderLayer.h
index 85053ca..4f78899 100644
--- a/Source/core/rendering/RenderLayer.h
+++ b/Source/core/rendering/RenderLayer.h
@@ -1021,8 +1021,6 @@
     // Rectangle encompassing the scroll corner and resizer rect.
     IntRect scrollCornerAndResizerRect() const;
 
-    // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
-    void scrollTo(int, int);
     void updateCompositingLayersAfterScroll();
 
     IntSize scrollbarOffset(const Scrollbar*) const;
diff --git a/Source/core/rendering/RenderLayerBacking.cpp b/Source/core/rendering/RenderLayerBacking.cpp
index 4c50398..7423b13 100644
--- a/Source/core/rendering/RenderLayerBacking.cpp
+++ b/Source/core/rendering/RenderLayerBacking.cpp
@@ -135,7 +135,6 @@
 #else
     UNUSED_PARAM(name);
 #endif
-    graphicsLayer->setMaintainsPixelAlignment(compositor()->keepLayersPixelAligned());
     
     return graphicsLayer.release();
 }
@@ -676,24 +675,26 @@
     if (m_scrollingLayer) {
         ASSERT(m_scrollingContentsLayer);
         RenderBox* renderBox = toRenderBox(renderer());
-        IntRect paddingBox(renderBox->borderLeft(), renderBox->borderTop(), renderBox->width() - renderBox->borderLeft() - renderBox->borderRight(), renderBox->height() - renderBox->borderTop() - renderBox->borderBottom());
-        IntSize scrollOffset = m_owningLayer->adjustedScrollOffset();
+        IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
+        // FIXME: We should make RenderBox::clientBoxRect consider scrollbar placement.
+        if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+            clientBox.move(renderBox->verticalScrollbarWidth(), 0);
 
-        m_scrollingLayer->setPosition(FloatPoint(paddingBox.location() - localCompositingBounds.location()));
-
-        m_scrollingLayer->setSize(paddingBox.size());
-        m_scrollingContentsLayer->setPosition(FloatPoint(-scrollOffset.width(), -scrollOffset.height()));
+        IntSize adjustedScrollOffset = m_owningLayer->adjustedScrollOffset();
+        m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCompositingBounds.location()));
+        m_scrollingLayer->setSize(clientBox.size());
+        m_scrollingContentsLayer->setPosition(FloatPoint(-adjustedScrollOffset.width(), -adjustedScrollOffset.height()));
 
         IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
-        m_scrollingLayer->setOffsetFromRenderer(-toIntSize(paddingBox.location()));
+        m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()));
 
-        bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
+        bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
 
         IntSize scrollSize(m_owningLayer->scrollWidth(), m_owningLayer->scrollHeight());
-        if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged)
+        if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetChanged)
             m_scrollingContentsLayer->setNeedsDisplay();
 
-        IntSize scrollingContentsOffset = toIntSize(paddingBox.location() - scrollOffset);
+        IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjustedScrollOffset);
         if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size())
             compositor()->scrollingLayerDidChange(m_owningLayer);
 
@@ -1681,16 +1682,6 @@
 #endif
 }
 
-float RenderLayerBacking::pageScaleFactor() const
-{
-    return compositor()->pageScaleFactor();
-}
-
-float RenderLayerBacking::deviceScaleFactor() const
-{
-    return compositor()->deviceScaleFactor();
-}
-
 void RenderLayerBacking::didCommitChangesForLayer(const GraphicsLayer* layer) const
 {
 }
@@ -1748,29 +1739,27 @@
         
         bool isFirstOrLastKeyframe = key == 0 || key == 1;
         if ((hasTransform && isFirstOrLastKeyframe) || currentKeyframe.containsProperty(CSSPropertyWebkitTransform))
-            transformVector.insert(new TransformAnimationValue(key, &(keyframeStyle->transform()), tf));
+            transformVector.insert(adoptPtr(new TransformAnimationValue(key, &(keyframeStyle->transform()), tf)));
         
         if ((hasOpacity && isFirstOrLastKeyframe) || currentKeyframe.containsProperty(CSSPropertyOpacity))
-            opacityVector.insert(new FloatAnimationValue(key, keyframeStyle->opacity(), tf));
+            opacityVector.insert(adoptPtr(new FloatAnimationValue(key, keyframeStyle->opacity(), tf)));
 
         if ((hasFilter && isFirstOrLastKeyframe) || currentKeyframe.containsProperty(CSSPropertyWebkitFilter))
-            filterVector.insert(new FilterAnimationValue(key, &(keyframeStyle->filter()), tf));
+            filterVector.insert(adoptPtr(new FilterAnimationValue(key, &(keyframeStyle->filter()), tf)));
     }
 
-    bool didAnimateTransform = false;
-    bool didAnimateOpacity = false;
-    bool didAnimateFilter = false;
-    
+    bool didAnimate = false;
+
     if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), anim, keyframes.animationName(), timeOffset))
-        didAnimateTransform = true;
+        didAnimate = true;
 
     if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), anim, keyframes.animationName(), timeOffset))
-        didAnimateOpacity = true;
+        didAnimate = true;
 
     if (hasFilter && m_graphicsLayer->addAnimation(filterVector, IntSize(), anim, keyframes.animationName(), timeOffset))
-        didAnimateFilter = true;
+        didAnimate = true;
 
-    return didAnimateTransform || didAnimateOpacity || didAnimateFilter;
+    return didAnimate;
 }
 
 void RenderLayerBacking::animationPaused(double timeOffset, const String& animationName)
@@ -1785,9 +1774,7 @@
 
 bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID property, const RenderStyle* fromStyle, const RenderStyle* toStyle)
 {
-    bool didAnimateOpacity = false;
-    bool didAnimateTransform = false;
-    bool didAnimateFilter = false;
+    bool didAnimate = false;
 
     ASSERT(property != CSSPropertyInvalid);
 
@@ -1795,13 +1782,13 @@
         const CSSAnimationData* opacityAnim = toStyle->transitionForProperty(CSSPropertyOpacity);
         if (opacityAnim && !opacityAnim->isEmptyOrZeroDuration()) {
             KeyframeValueList opacityVector(AnimatedPropertyOpacity);
-            opacityVector.insert(new FloatAnimationValue(0, compositingOpacity(fromStyle->opacity())));
-            opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity())));
+            opacityVector.insert(adoptPtr(new FloatAnimationValue(0, compositingOpacity(fromStyle->opacity()))));
+            opacityVector.insert(adoptPtr(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity()))));
             // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here.
             if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) {
                 // To ensure that the correct opacity is visible when the animation ends, also set the final opacity.
                 updateOpacity(toStyle);
-                didAnimateOpacity = true;
+                didAnimate = true;
             }
         }
     }
@@ -1810,12 +1797,12 @@
         const CSSAnimationData* transformAnim = toStyle->transitionForProperty(CSSPropertyWebkitTransform);
         if (transformAnim && !transformAnim->isEmptyOrZeroDuration()) {
             KeyframeValueList transformVector(AnimatedPropertyWebkitTransform);
-            transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform()));
-            transformVector.insert(new TransformAnimationValue(1, &toStyle->transform()));
+            transformVector.insert(adoptPtr(new TransformAnimationValue(0, &fromStyle->transform())));
+            transformVector.insert(adoptPtr(new TransformAnimationValue(1, &toStyle->transform())));
             if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) {
                 // To ensure that the correct transform is visible when the animation ends, also set the final transform.
                 updateTransform(toStyle);
-                didAnimateTransform = true;
+                didAnimate = true;
             }
         }
     }
@@ -1824,17 +1811,17 @@
         const CSSAnimationData* filterAnim = toStyle->transitionForProperty(CSSPropertyWebkitFilter);
         if (filterAnim && !filterAnim->isEmptyOrZeroDuration()) {
             KeyframeValueList filterVector(AnimatedPropertyWebkitFilter);
-            filterVector.insert(new FilterAnimationValue(0, &fromStyle->filter()));
-            filterVector.insert(new FilterAnimationValue(1, &toStyle->filter()));
+            filterVector.insert(adoptPtr(new FilterAnimationValue(0, &fromStyle->filter())));
+            filterVector.insert(adoptPtr(new FilterAnimationValue(1, &toStyle->filter())));
             if (m_graphicsLayer->addAnimation(filterVector, IntSize(), filterAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitFilter), timeOffset)) {
                 // To ensure that the correct filter is visible when the animation ends, also set the final filter.
                 updateFilters(toStyle);
-                didAnimateFilter = true;
+                didAnimate = true;
             }
         }
     }
 
-    return didAnimateOpacity || didAnimateTransform || didAnimateFilter;
+    return didAnimate;
 }
 
 void RenderLayerBacking::transitionPaused(double timeOffset, CSSPropertyID property)
diff --git a/Source/core/rendering/RenderLayerBacking.h b/Source/core/rendering/RenderLayerBacking.h
index f13c487..29127e0 100644
--- a/Source/core/rendering/RenderLayerBacking.h
+++ b/Source/core/rendering/RenderLayerBacking.h
@@ -148,8 +148,6 @@
 
     virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip) OVERRIDE;
 
-    virtual float deviceScaleFactor() const OVERRIDE;
-    virtual float pageScaleFactor() const OVERRIDE;
     virtual void didCommitChangesForLayer(const GraphicsLayer*) const OVERRIDE;
     virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const OVERRIDE;
 
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp
index 48e0463..d566103 100644
--- a/Source/core/rendering/RenderLayerCompositor.cpp
+++ b/Source/core/rendering/RenderLayerCompositor.cpp
@@ -2135,29 +2135,11 @@
     return m_isTrackingRepaints;
 }
 
-float RenderLayerCompositor::deviceScaleFactor() const
-{
-    Page* page = this->page();
-    return page ? page->deviceScaleFactor() : 1;
-}
-
-float RenderLayerCompositor::pageScaleFactor() const
-{
-    Page* page = this->page();
-    return page ? page->pageScaleFactor() : 1;
-}
-
 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const
 {
     // Nothing to do here yet.
 }
 
-bool RenderLayerCompositor::keepLayersPixelAligned() const
-{
-    // When scaling, attempt to align compositing layers to pixel boundaries.
-    return true;
-}
-
 static bool shouldCompositeOverflowControls(FrameView* view)
 {
     if (Page* page = view->frame()->page()) {
@@ -2633,17 +2615,6 @@
     return false;
 }
 
-void RenderLayerCompositor::deviceOrPageScaleFactorChanged()
-{
-    // Start at the RenderView's layer, since that's where the scale is applied.
-    RenderLayer* viewLayer = m_renderView->layer();
-    if (!viewLayer->isComposited())
-        return;
-
-    if (GraphicsLayer* rootLayer = viewLayer->backing()->childForSuperlayers())
-        rootLayer->noteDeviceOrPageScaleFactorChangedIncludingDescendants();
-}
-
 static bool isRootmostFixedOrStickyLayer(RenderLayer* layer)
 {
     if (layer->renderer()->isStickyPositioned())
diff --git a/Source/core/rendering/RenderLayerCompositor.h b/Source/core/rendering/RenderLayerCompositor.h
index a9579cb..edd86a2 100644
--- a/Source/core/rendering/RenderLayerCompositor.h
+++ b/Source/core/rendering/RenderLayerCompositor.h
@@ -204,14 +204,8 @@
 
     String layerTreeAsText(LayerTreeFlags);
 
-    virtual float deviceScaleFactor() const OVERRIDE;
-    virtual float pageScaleFactor() const OVERRIDE;
     virtual void didCommitChangesForLayer(const GraphicsLayer*) const OVERRIDE;
 
-    bool keepLayersPixelAligned() const;
-
-    void deviceOrPageScaleFactorChanged();
-
     GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
     GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
     GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index 6965c96..89daaa6 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -2379,7 +2379,8 @@
     if (frame()) {
         if (FrameView* view = frame()->view()) {
             if (view->layoutRoot() == this) {
-                ASSERT_NOT_REACHED();
+                if (!documentBeingDestroyed())
+                    ASSERT_NOT_REACHED();
                 // This indicates a failure to layout the child, which is why
                 // the layout root is still set to |this|. Make sure to clear it
                 // since we are getting destroyed.
diff --git a/Source/core/rendering/RenderSlider.cpp b/Source/core/rendering/RenderSlider.cpp
index cac447a..58cf9bc 100644
--- a/Source/core/rendering/RenderSlider.cpp
+++ b/Source/core/rendering/RenderSlider.cpp
@@ -29,7 +29,7 @@
 #include "core/dom/EventNames.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/Node.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/StepRange.h"
 #include "core/html/parser/HTMLParserIdioms.h"
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
index 9419917..4615fe6 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -1324,7 +1324,7 @@
     }
     for (RootInlineBox* curr = firstRootBox; curr && curr != lastRootBox; curr = curr->nextRootBox()) {
         if (curr->lineBreakObj() == this && curr->lineBreakPos() > end)
-            curr->setLineBreakPos(curr->lineBreakPos() + delta);
+            curr->setLineBreakPos(clampToInteger(curr->lineBreakPos() + delta));
     }
 
     // If the text node is empty, dirty the line where new text will be inserted.
diff --git a/Source/core/rendering/RenderText.h b/Source/core/rendering/RenderText.h
index 400087c..e2f3d61 100644
--- a/Source/core/rendering/RenderText.h
+++ b/Source/core/rendering/RenderText.h
@@ -59,10 +59,10 @@
     void dirtyLineBoxes(bool fullLayout);
 
     virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const OVERRIDE FINAL;
-    void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0);
+    void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0);
 
     virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRIDE FINAL;
-    void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0);
+    void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, unsigned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0);
 
     enum ClippingOption { NoClipping, ClipToEllipsis };
     void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed = 0, ClippingOption = NoClipping) const;
diff --git a/Source/core/rendering/RenderTextControlMultiLine.cpp b/Source/core/rendering/RenderTextControlMultiLine.cpp
index 4a2fc16..3ffc0ef 100644
--- a/Source/core/rendering/RenderTextControlMultiLine.cpp
+++ b/Source/core/rendering/RenderTextControlMultiLine.cpp
@@ -23,7 +23,7 @@
 #include "core/rendering/RenderTextControlMultiLine.h"
 
 #include "HTMLNames.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLTextAreaElement.h"
 #include "core/html/shadow/TextControlInnerElements.h"
 #include "core/page/Frame.h"
diff --git a/Source/core/rendering/RenderTheme.cpp b/Source/core/rendering/RenderTheme.cpp
index dbbf5bf..5f5a0e4 100644
--- a/Source/core/rendering/RenderTheme.cpp
+++ b/Source/core/rendering/RenderTheme.cpp
@@ -52,7 +52,7 @@
 #endif
 
 #if ENABLE(DATALIST_ELEMENT)
-#include "core/dom/ElementShadow.h"
+#include "core/dom/shadow/ElementShadow.h"
 #include "core/html/HTMLCollection.h"
 #include "core/html/HTMLDataListElement.h"
 #include "core/html/HTMLOptionElement.h"
diff --git a/Source/core/rendering/style/ShadowData.cpp b/Source/core/rendering/style/ShadowData.cpp
index d1621b5..1723b19 100644
--- a/Source/core/rendering/style/ShadowData.cpp
+++ b/Source/core/rendering/style/ShadowData.cpp
@@ -34,7 +34,6 @@
     , m_spread(o.m_spread)
     , m_color(o.m_color)
     , m_style(o.m_style)
-    , m_isWebkitBoxShadow(o.m_isWebkitBoxShadow)
     , m_next(o.m_next ? adoptPtr(new ShadowData(*o.m_next)) : nullptr)
 {
 }
@@ -49,8 +48,7 @@
         && m_blur == o.m_blur
         && m_spread == o.m_spread
         && m_style == o.m_style
-        && m_color == o.m_color
-        && m_isWebkitBoxShadow == o.m_isWebkitBoxShadow;
+        && m_color == o.m_color;
 }
 
 static inline void calculateShadowExtent(const ShadowData* shadow, int additionalOutlineSize, int& shadowLeft, int& shadowRight, int& shadowTop, int& shadowBottom)
diff --git a/Source/core/rendering/style/ShadowData.h b/Source/core/rendering/style/ShadowData.h
index fbf3b95..facb296 100644
--- a/Source/core/rendering/style/ShadowData.h
+++ b/Source/core/rendering/style/ShadowData.h
@@ -44,17 +44,15 @@
         : m_blur(0)
         , m_spread(0)
         , m_style(Normal)
-        , m_isWebkitBoxShadow(false)
     {
     }
 
-    ShadowData(const IntPoint& location, int blur, int spread, ShadowStyle style, bool isWebkitBoxShadow, const Color& color)
+    ShadowData(const IntPoint& location, int blur, int spread, ShadowStyle style, const Color& color)
         : m_location(location)
         , m_blur(blur)
         , m_spread(spread)
         , m_color(color)
         , m_style(style)
-        , m_isWebkitBoxShadow(isWebkitBoxShadow)
     {
     }
 
@@ -73,7 +71,6 @@
     int spread() const { return m_spread; }
     ShadowStyle style() const { return m_style; }
     const Color& color() const { return m_color; }
-    bool isWebkitBoxShadow() const { return m_isWebkitBoxShadow; }
 
     const ShadowData* next() const { return m_next.get(); }
     void setNext(PassOwnPtr<ShadowData> shadow) { m_next = shadow; }
@@ -87,7 +84,6 @@
     int m_spread;
     Color m_color;
     ShadowStyle m_style;
-    bool m_isWebkitBoxShadow;
     OwnPtr<ShadowData> m_next;
 };
 
diff --git a/Source/core/rendering/svg/RenderSVGResourceFilterPrimitive.cpp b/Source/core/rendering/svg/RenderSVGResourceFilterPrimitive.cpp
index 7f985b2..2d38242 100644
--- a/Source/core/rendering/svg/RenderSVGResourceFilterPrimitive.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceFilterPrimitive.cpp
@@ -74,11 +74,11 @@
         for (unsigned i = 1; i < numberOfInputEffects; ++i)
             subregion.unite(determineFilterPrimitiveSubregion(effect->inputEffect(i)));
     } else
-        subregion = filter->filterRegionInUserSpace();
+        subregion = filter->filterRegion();
 
     // After calling determineFilterPrimitiveSubregion on the target effect, reset the subregion again for <feTile>.
     if (effect->filterEffectType() == FilterEffectTypeTile)
-        subregion = filter->filterRegionInUserSpace();
+        subregion = filter->filterRegion();
 
     FloatRect effectBoundaries = effect->effectBoundaries();
     if (effect->hasX())
@@ -97,7 +97,7 @@
     absoluteSubregion.scale(filterResolution.width(), filterResolution.height());
 
     // Clip every filter effect to the filter region.
-    FloatRect absoluteScaledFilterRegion = filter->filterRegion();
+    FloatRect absoluteScaledFilterRegion = filter->absoluteFilterRegion();
     absoluteScaledFilterRegion.scale(filterResolution.width(), filterResolution.height());
     absoluteSubregion.intersect(absoluteScaledFilterRegion);
 
diff --git a/Source/core/scripts/in_generator.py b/Source/core/scripts/in_generator.py
index dad625e..175fb46 100644
--- a/Source/core/scripts/in_generator.py
+++ b/Source/core/scripts/in_generator.py
@@ -30,6 +30,7 @@
 import shutil
 
 from in_file import InFile
+import template_expander
 
 
 class Writer(object):
@@ -84,6 +85,8 @@
 
     def _write_file(self, output_dir, generator, file_name):
         contents = generator()
+        if type(contents) is dict:
+            contents = template_expander.apply_template(file_name + ".tmpl", contents)
         if not contents:
             return
         path = os.path.join(output_dir, file_name)
diff --git a/Source/core/scripts/make_internal_runtime_flags.py b/Source/core/scripts/make_internal_runtime_flags.py
index 5c6fbf7..dc33323 100755
--- a/Source/core/scripts/make_internal_runtime_flags.py
+++ b/Source/core/scripts/make_internal_runtime_flags.py
@@ -31,84 +31,23 @@
 import sys
 
 import in_generator
-import license
 import make_runtime_features
 
 
-IDL_TEMPLATE = """
-%(license)s
-[
-    ImplementationLacksVTable
-] interface %(class_name)s {
-%(attribute_declarations)s
-};
-"""
-
-HEADER_TEMPLATE = """%(license)s
-#ifndef %(class_name)s_h
-#define %(class_name)s_h
-
-#include "RuntimeEnabledFeatures.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class %(class_name)s : public RefCounted<%(class_name)s> {
-public:
-    static PassRefPtr<%(class_name)s> create()
-    {
-        return adoptRef(new %(class_name)s);
-    }
-
-%(method_declarations)s
-
-private:
-    %(class_name)s() { }
-};
-
-} // namespace WebCore
-
-#endif // %(class_name)s_h
-"""
-
 # We want exactly the same parsing as RuntimeFeatureWriter
 # but generate different files.
 class InternalRuntimeFlagsWriter(make_runtime_features.RuntimeFeatureWriter):
     class_name = "InternalRuntimeFlags"
 
-    def __init__(self, *args, **kwargs):
-        make_runtime_features.RuntimeFeatureWriter.__init__(self, *args, **kwargs)
-        for feature in self._all_features:
-            feature['idl_attributes'] = "[Conditional=%(condition)s]" % feature if feature['condition'] else ""
-
-    def _attribute_declaration(self, feature):
-        # Currently assuming that runtime flags cannot be changed after startup
-        # it's possible that some can be and should be conditionally readonly.
-        return "    %(idl_attributes)s readonly attribute boolean %(first_lowered_name)sEnabled;" % feature
-
     def generate_idl(self):
-        return IDL_TEMPLATE % {
-            'class_name' : self.class_name,
-            'license' : license.license_for_generated_cpp(),
-            'attribute_declarations': "\n".join(map(self._attribute_declaration, self._non_custom_features))
+        return {
+            'features': self._features,
         }
 
-    def _method_declaration(self, feature):
-        # Setting after startup does not work for most runtime flags, but we
-        # could add an option to print setters for ones which do:
-        # void set%(name)sEnabled(bool isEnabled) { RuntimeEnabledFeatures::set%(name)sEnabled(isEnabled); }
-        # If we do that, we also need to respect Internals::resetToConsistentState.
-        declaration = """    bool %(first_lowered_name)sEnabled() { return RuntimeEnabledFeatures::%(first_lowered_name)sEnabled(); }
-""" % feature
-        return self.wrap_with_condition(declaration, feature['condition'])
-
     def generate_header(self):
-        return HEADER_TEMPLATE % {
-            'class_name' : self.class_name,
-            'license' : license.license_for_generated_cpp(),
-            'method_declarations' : "\n".join(map(self._method_declaration, self._non_custom_features)),
+        return {
+            'features': self._features,
+            'feature_sets': self._feature_sets(),
         }
 
     def generate_implementation(self):
diff --git a/Source/core/scripts/make_runtime_features.py b/Source/core/scripts/make_runtime_features.py
index 6b10892..940843b 100755
--- a/Source/core/scripts/make_runtime_features.py
+++ b/Source/core/scripts/make_runtime_features.py
@@ -32,45 +32,8 @@
 
 from in_file import InFile
 import in_generator
-import license
 
 
-HEADER_TEMPLATE = """%(license)s
-#ifndef %(class_name)s_h
-#define %(class_name)s_h
-
-namespace WebCore {
-
-// A class that stores static enablers for all experimental features.
-
-class %(class_name)s {
-public:
-%(set_toggle_declarations)s
-
-%(accessor_declarations)s
-private:
-    %(class_name)s() { }
-
-%(storage_declarations)s
-};
-
-} // namespace WebCore
-
-#endif // %(class_name)s_h
-"""
-
-IMPLEMENTATION_TEMPLATE = """%(license)s
-#include "config.h"
-#include "%(class_name)s.h"
-
-namespace WebCore {
-
-%(set_toggle_definitions)s
-%(storage_definitions)s
-
-} // namespace WebCore
-"""
-
 class RuntimeFeatureWriter(in_generator.Writer):
     class_name = 'RuntimeEnabledFeatures'
 
@@ -87,9 +50,9 @@
 
     def __init__(self, in_file_path):
         super(RuntimeFeatureWriter, self).__init__(in_file_path)
-        self._all_features = self.in_file.name_dictionaries
+        self._features = self.in_file.name_dictionaries
         # Make sure the resulting dictionaries have all the keys we expect.
-        for feature in self._all_features:
+        for feature in self._features:
             feature['first_lowered_name'] = self._lower_first(feature['name'])
             # Most features just check their isFooEnabled bool
             # but some depend on more than one bool.
@@ -97,7 +60,7 @@
             for dependant_name in feature['depends_on']:
                 enabled_condition += " && is%sEnabled" % dependant_name
             feature['enabled_condition'] = enabled_condition
-        self._non_custom_features = filter(lambda feature: not feature['custom'], self._all_features)
+        self._non_custom_features = filter(lambda feature: not feature['custom'], self._features)
 
     def _lower_first(self, string):
         lowered = string[0].lower() + string[1:]
@@ -105,67 +68,21 @@
         lowered = lowered.replace("iME", "ime")
         return lowered
 
-    def _feature_set_declaration(self, feature_set):
-        return "    static void set%sFeaturesEnabled(bool);" % feature_set.capitalize()
-
-    def _feature_accessor_declaration(self, feature):
-        if feature['custom']:
-            return "    static bool %(first_lowered_name)sEnabled();\n" % feature
-        unconditional = """    static void set%(name)sEnabled(bool isEnabled) { is%(name)sEnabled = isEnabled; }
-    static bool %(first_lowered_name)sEnabled() { return %(enabled_condition)s; }
-"""
-        conditional = "#if ENABLE(%(condition)s)\n" + unconditional + """#else
-    static void set%(name)sEnabled(bool) { }
-    static bool %(first_lowered_name)sEnabled() { return false; }
-#endif
-"""
-        template = conditional if feature['condition'] else unconditional
-        return template % feature
-
-    def _storage_declarations(self, feature):
-        declaration = "    static bool is%(name)sEnabled;" % feature
-        return self.wrap_with_condition(declaration, feature['condition'])
-
-    def generate_header(self):
-        return HEADER_TEMPLATE % {
-            'class_name' : self.class_name,
-            'license' : license.license_for_generated_cpp(),
-            'set_toggle_declarations' : "\n".join(map(self._feature_set_declaration, self._feature_sets())),
-            'accessor_declarations' : "\n".join(map(self._feature_accessor_declaration, self._all_features)),
-            'storage_declarations' : "\n".join(map(self._storage_declarations, self._non_custom_features)),
-        }
-
     def _feature_sets(self):
         # Another way to think of the status levels is as "sets of features"
         # which is how we're referring to them in this generator.
         return self.valid_values['status']
 
-    def _feature_toggle(self, feature):
-        return "    set%(name)sEnabled(enable);" % feature
-
-    def _feature_set_definition(self, feature_set):
-        features_in_set = filter(lambda feature: feature['status'] == feature_set, self._all_features)
-        template = """void %(class_name)s::set%(feature_set)sFeaturesEnabled(bool enable)
-{
-%(feature_toggles)s
-}
-"""
-        return template % {
-            'class_name': self.class_name,
-            'feature_set': feature_set.capitalize(),
-            'feature_toggles': "\n".join(map(self._feature_toggle, features_in_set)),
+    def generate_header(self):
+        return {
+            'features': self._features,
+            'feature_sets': self._feature_sets(),
         }
 
-    def _storage_definition(self, feature):
-        definition = "bool RuntimeEnabledFeatures::is%(name)sEnabled = false;" % feature
-        return self.wrap_with_condition(definition, feature['condition'])
-
     def generate_implementation(self):
-        return IMPLEMENTATION_TEMPLATE % {
-            'class_name' : self.class_name,
-            'license' : license.license_for_generated_cpp(),
-            'set_toggle_definitions' : '\n'.join(map(self._feature_set_definition, self._feature_sets())),
-            'storage_definitions' : '\n'.join(map(self._storage_definition, self._non_custom_features)),
+        return {
+            'features': self._features,
+            'feature_sets': self._feature_sets(),
         }
 
 
diff --git a/Source/core/scripts/name_macros.py b/Source/core/scripts/name_macros.py
index 4700e26..4c4601d 100644
--- a/Source/core/scripts/name_macros.py
+++ b/Source/core/scripts/name_macros.py
@@ -72,7 +72,6 @@
         return entry['interfaceName']
     return os.path.basename(entry['name'])
 
-
 class Writer(in_generator.Writer):
     def __init__(self, in_file_path):
         super(Writer, self).__init__(in_file_path)
diff --git a/Source/core/scripts/template_expander.py b/Source/core/scripts/template_expander.py
new file mode 100644
index 0000000..60a272c
--- /dev/null
+++ b/Source/core/scripts/template_expander.py
@@ -0,0 +1,43 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+import sys
+
+_current_dir = os.path.dirname(os.path.realpath(__file__))
+# jinja2 is in chromium's third_party directory
+sys.path.append(os.path.join(_current_dir, *([os.pardir] * 4)))
+import jinja2
+
+
+def apply_template(path_to_template, params):
+    dirname, basename = os.path.split(path_to_template)
+    path_to_templates = os.path.join(_current_dir, "templates")
+    jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader([dirname, path_to_templates]))
+    template = jinja_env.get_template(basename)
+    return template.render(params)
diff --git a/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl b/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl
new file mode 100644
index 0000000..fe77d0c
--- /dev/null
+++ b/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl
@@ -0,0 +1,40 @@
+{% from "macros.tmpl" import wrap_with_condition, license -%}
+{{ license() }}
+
+#ifndef InternalRuntimeFlags_h
+#define InternalRuntimeFlags_h
+
+#include "RuntimeEnabledFeatures.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class InternalRuntimeFlags : public RefCounted<InternalRuntimeFlags> {
+public:
+    static PassRefPtr<InternalRuntimeFlags> create()
+    {
+        return adoptRef(new InternalRuntimeFlags);
+    }
+
+{#-
+    Setting after startup does not work for most runtime flags, but we
+    could add an option to print setters for ones which do:
+    void set{{feature.name}}Enabled(bool isEnabled) { RuntimeEnabledFeatures::set{{feature.name}}Enabled(isEnabled); }
+    If we do that, we also need to respect Internals::resetToConsistentState.
+#}
+{% for feature in features if not feature.custom %}
+{%- call wrap_with_condition(feature.condition) %}
+    bool {{feature.first_lowered_name}}Enabled() { return RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled(); }
+{%- endcall %}
+{% endfor %}
+
+private:
+    InternalRuntimeFlags() { }
+};
+
+} // namespace WebCore
+
+#endif // InternalRuntimeFlags_h
+
diff --git a/Source/core/scripts/templates/InternalRuntimeFlags.idl.tmpl b/Source/core/scripts/templates/InternalRuntimeFlags.idl.tmpl
new file mode 100644
index 0000000..31a4bfd
--- /dev/null
+++ b/Source/core/scripts/templates/InternalRuntimeFlags.idl.tmpl
@@ -0,0 +1,16 @@
+{% from "macros.tmpl" import license -%}
+{{ license() }}
+
+[
+    ImplementationLacksVTable
+] interface InternalRuntimeFlags {
+{%- for feature in features if not feature.custom %}
+{#-
+    Currently assuming that runtime flags cannot be changed after startup
+    it's possible that some can be and should be conditionally readonly.
+#}
+    {% if feature.condition -%} [Conditional={{feature.condition}}] {% endif -%}
+    readonly attribute boolean {{feature.first_lowered_name}}Enabled;
+{%- endfor %}
+};
+
diff --git a/Source/core/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl b/Source/core/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
new file mode 100644
index 0000000..4affac1
--- /dev/null
+++ b/Source/core/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
@@ -0,0 +1,25 @@
+{% from "macros.tmpl" import wrap_with_condition, license -%}
+{{ license() }}
+
+#include "config.h"
+#include "RuntimeEnabledFeatures.h"
+
+namespace WebCore {
+
+{% for feature_set in feature_sets %}
+void RuntimeEnabledFeatures::set{{feature_set|capitalize}}FeaturesEnabled(bool enable)
+{
+{%- for feature in features if feature.status == feature_set %}
+    set{{feature.name}}Enabled(enable);
+{%- endfor %}
+}
+{% endfor %}
+
+{%- for feature in features if not feature.custom %}
+{%- call wrap_with_condition(feature.condition) %}
+bool RuntimeEnabledFeatures::is{{feature.name}}Enabled = false;
+{%- endcall %}
+{%- endfor %}
+
+} // namespace WebCore
+
diff --git a/Source/core/scripts/templates/RuntimeEnabledFeatures.h.tmpl b/Source/core/scripts/templates/RuntimeEnabledFeatures.h.tmpl
new file mode 100644
index 0000000..2e23c87
--- /dev/null
+++ b/Source/core/scripts/templates/RuntimeEnabledFeatures.h.tmpl
@@ -0,0 +1,48 @@
+{% from "macros.tmpl" import wrap_with_condition, license -%}
+{{ license() }}
+
+#ifndef RuntimeEnabledFeatures_h
+#define RuntimeEnabledFeatures_h
+
+namespace WebCore {
+
+// A class that stores static enablers for all experimental features.
+
+class RuntimeEnabledFeatures {
+public:
+
+{%- for feature_set in feature_sets %}
+    static void set{{feature_set|capitalize}}FeaturesEnabled(bool);
+{%- endfor %}
+
+{% for feature in features %}
+{%- if feature.custom %}
+    static bool {{feature.first_lowered_name}}Enabled();
+{%- else %}
+{%- if feature.condition %}
+#if ENABLE({{feature.condition}})
+{%- endif %}
+    static void set{{feature.name}}Enabled(bool isEnabled) { is{{feature.name}}Enabled = isEnabled; }
+    static bool {{feature.first_lowered_name}}Enabled() { return {{feature.enabled_condition}}; }
+{%- if feature.condition %}
+#else
+    static void set{{feature.name}}Enabled(bool) { }
+    static bool {{feature.first_lowered_name}}Enabled() { return false; }
+#endif
+{%- endif %}
+{%- endif %}
+{% endfor %}
+
+private:
+    RuntimeEnabledFeatures() { }
+{% for feature in features if not feature.custom %}
+{%- call wrap_with_condition(feature.condition) %}
+    static bool is{{feature.name}}Enabled;
+{%- endcall %}
+{%- endfor %}
+};
+
+} // namespace WebCore
+
+#endif // RuntimeEnabledFeatures_h
+
diff --git a/Source/core/html/DOMFormData.idl b/Source/core/scripts/templates/macros.tmpl
similarity index 72%
copy from Source/core/html/DOMFormData.idl
copy to Source/core/scripts/templates/macros.tmpl
index 25d9ed1..ce92743 100644
--- a/Source/core/html/DOMFormData.idl
+++ b/Source/core/scripts/templates/macros.tmpl
@@ -1,5 +1,19 @@
+{% macro wrap_with_condition(condition) %}
+{%- if condition %}
+#if ENABLE({{condition}})
+{{- caller() }}
+#endif
+{%- else %}
+{{- caller() }}
+{%- endif %}
+{%- endmacro %}
+
+{#
+    FIXME: Do we need to put license blocks in generated files?
+#}
+{% macro license() -%}
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -27,16 +41,4 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
-[
-    CustomConstructor(optional HTMLFormElement form),
-    InterfaceName=FormData,
-    ImplementationLacksVTable
-] interface DOMFormData {
-    // void append(DOMString name, DOMString value);
-    // void append(DOMString name, Blob value, optional DOMString filename);
-    [Custom] void append([Default=Undefined] optional DOMString name, 
-                         [Default=Undefined] optional DOMString value,
-                         [Default=Undefined] optional DOMString filename);
-};
-
+{%- endmacro %}
diff --git a/Source/core/svg/SVGAnimateMotionElement.cpp b/Source/core/svg/SVGAnimateMotionElement.cpp
index 15dbd8d..64955bb 100644
--- a/Source/core/svg/SVGAnimateMotionElement.cpp
+++ b/Source/core/svg/SVGAnimateMotionElement.cpp
@@ -231,14 +231,15 @@
 
     bool ok = false;
     float positionOnPath = m_animationPath.length() * percentage;
-    FloatPoint position = m_animationPath.pointAtLength(positionOnPath, ok);
+    FloatPoint position;
+    float angle;
+    ok = m_animationPath.pointAndNormalAtLength(positionOnPath, position, angle);
     if (!ok)
         return;
     transform->translate(position.x(), position.y());
     RotateMode rotateMode = this->rotateMode();
     if (rotateMode != RotateAuto && rotateMode != RotateAutoReverse)
         return;
-    float angle = m_animationPath.normalAngleAtLength(positionOnPath, ok);
     if (rotateMode == RotateAutoReverse)
         angle += 180;
     transform->rotate(angle);
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp
index c2519cf..6de8fd8 100644
--- a/Source/core/svg/SVGElement.cpp
+++ b/Source/core/svg/SVGElement.cpp
@@ -80,10 +80,9 @@
         delete rareData;
 
         // The rare data cleanup may have caused other SVG nodes to be deleted,
-        // modifying the rare data map, so we must re-get the iterator here.
-        it = rareDataMap.find(this);
-        ASSERT(it != rareDataMap.end());
-        rareDataMap.remove(it);
+        // modifying the rare data map. Do not rely on the existing iterator.
+        ASSERT(rareDataMap.contains(this));
+        rareDataMap.remove(this);
     }
     ASSERT(document());
     document()->accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
diff --git a/Source/core/svg/SVGFilterElement.h b/Source/core/svg/SVGFilterElement.h
index 57d1ec1..141bb84 100644
--- a/Source/core/svg/SVGFilterElement.h
+++ b/Source/core/svg/SVGFilterElement.h
@@ -24,6 +24,7 @@
 #define SVGFilterElement_h
 
 #if ENABLE(SVG)
+#include "SVGNames.h"
 #include "core/svg/SVGAnimatedBoolean.h"
 #include "core/svg/SVGAnimatedEnumeration.h"
 #include "core/svg/SVGAnimatedInteger.h"
@@ -77,6 +78,12 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
+inline SVGFilterElement* toSVGFilterElement(SVGElement* element)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!element || element->hasTagName(SVGNames::filterTag));
+    return static_cast<SVGFilterElement*>(element);
+}
+
 }
 
 #endif
diff --git a/Source/core/svg/SVGStyledElement.cpp b/Source/core/svg/SVGStyledElement.cpp
index 69e1deb..eed34c7 100644
--- a/Source/core/svg/SVGStyledElement.cpp
+++ b/Source/core/svg/SVGStyledElement.cpp
@@ -30,7 +30,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/style/SVGRenderStyle.h"
 #include "core/rendering/svg/RenderSVGResource.h"
diff --git a/Source/core/svg/SVGTRefElement.cpp b/Source/core/svg/SVGTRefElement.cpp
index 2ca5857..27ba62a 100644
--- a/Source/core/svg/SVGTRefElement.cpp
+++ b/Source/core/svg/SVGTRefElement.cpp
@@ -26,14 +26,14 @@
 
 #include "SVGNames.h"
 #include "XLinkNames.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/MutationEvent.h"
 #include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/Text.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/page/UseCounter.h"
 #include "core/rendering/style/StyleInheritedData.h"
 #include "core/rendering/svg/RenderSVGInline.h"
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 404a5d4..790d501 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -33,13 +33,13 @@
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventListener.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/RegisteredEventListener.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
 #include "core/loader/cache/CachedSVGDocument.h"
diff --git a/Source/core/svg/graphics/filters/SVGFilter.cpp b/Source/core/svg/graphics/filters/SVGFilter.cpp
index ff85c6a..f514240 100644
--- a/Source/core/svg/graphics/filters/SVGFilter.cpp
+++ b/Source/core/svg/graphics/filters/SVGFilter.cpp
@@ -30,24 +30,24 @@
     : Filter(absoluteTransform)
     , m_absoluteSourceDrawingRegion(absoluteSourceDrawingRegion)
     , m_targetBoundingBox(targetBoundingBox)
-    , m_filterRegion(filterRegion)
     , m_effectBBoxMode(effectBBoxMode)
 {
-    m_absoluteFilterRegion = absoluteTransform.mapRect(filterRegion);
+    setFilterRegion(filterRegion);
+    setAbsoluteFilterRegion(absoluteTransform.mapRect(filterRegion));
 }
 
 float SVGFilter::applyHorizontalScale(float value) const
 {
     if (m_effectBBoxMode)
         value *= m_targetBoundingBox.width();
-    return Filter::applyHorizontalScale(value) * m_absoluteFilterRegion.width() / m_filterRegion.width();
+    return Filter::applyHorizontalScale(value) * absoluteFilterRegion().width() / filterRegion().width();
 }
 
 float SVGFilter::applyVerticalScale(float value) const
 {
     if (m_effectBBoxMode)
         value *= m_targetBoundingBox.height();
-    return Filter::applyVerticalScale(value) * m_absoluteFilterRegion.height() / m_filterRegion.height();
+    return Filter::applyVerticalScale(value) * absoluteFilterRegion().height() / filterRegion().height();
 }
 
 PassRefPtr<SVGFilter> SVGFilter::create(const AffineTransform& absoluteTransform, const FloatRect& absoluteSourceDrawingRegion, const FloatRect& targetBoundingBox, const FloatRect& filterRegion, bool effectBBoxMode)
diff --git a/Source/core/svg/graphics/filters/SVGFilter.h b/Source/core/svg/graphics/filters/SVGFilter.h
index 61ed399..3b1232d 100644
--- a/Source/core/svg/graphics/filters/SVGFilter.h
+++ b/Source/core/svg/graphics/filters/SVGFilter.h
@@ -38,9 +38,6 @@
 public:
     static PassRefPtr<SVGFilter> create(const AffineTransform&, const FloatRect&, const FloatRect&, const FloatRect&, bool);
 
-    FloatRect filterRegionInUserSpace() const { return m_filterRegion; }
-    virtual FloatRect filterRegion() const { return m_absoluteFilterRegion; }
-
     virtual float applyHorizontalScale(float value) const;
     virtual float applyVerticalScale(float value) const;
 
@@ -52,8 +49,6 @@
 
     FloatRect m_absoluteSourceDrawingRegion;
     FloatRect m_targetBoundingBox;
-    FloatRect m_absoluteFilterRegion;
-    FloatRect m_filterRegion;
     bool m_effectBBoxMode;
 };
 
diff --git a/Source/core/testing/InternalSettings.cpp b/Source/core/testing/InternalSettings.cpp
index e018378..4394f8e 100644
--- a/Source/core/testing/InternalSettings.cpp
+++ b/Source/core/testing/InternalSettings.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "InternalSettings.h"
 
+#include "RuntimeEnabledFeatures.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/page/CaptionUserPreferences.h"
@@ -34,7 +35,6 @@
 #include "core/page/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/PageGroup.h"
-#include "RuntimeEnabledFeatures.h"
 #include "core/page/Settings.h"
 #include "core/platform/Language.h"
 #include "core/platform/Supplementable.h"
@@ -70,12 +70,12 @@
     , m_originalCSSVariablesEnabled(settings->cssVariablesEnabled())
     , m_originalAuthorShadowDOMForAnyElementEnabled(RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled())
     , m_originalExperimentalShadowDOMEnabled(RuntimeEnabledFeatures::experimentalShadowDOMEnabled())
+    , m_originalExperimentalWebSocketEnabled(settings->experimentalWebSocketEnabled())
     , m_originalStyleScoped(RuntimeEnabledFeatures::styleScopedEnabled())
     , m_originalEditingBehavior(settings->editingBehaviorType())
     , m_originalTextAutosizingEnabled(settings->textAutosizingEnabled())
     , m_originalTextAutosizingWindowSizeOverride(settings->textAutosizingWindowSizeOverride())
     , m_originalTextAutosizingFontScaleFactor(settings->textAutosizingFontScaleFactor())
-    , m_originalResolutionOverride(settings->resolutionOverride())
     , m_originalMediaTypeOverride(settings->mediaTypeOverride())
     , m_originalDialogElementEnabled(RuntimeEnabledFeatures::dialogElementEnabled())
     , m_originalLazyLayoutEnabled(RuntimeEnabledFeatures::lazyLayoutEnabled())
@@ -95,12 +95,12 @@
     settings->setCSSVariablesEnabled(m_originalCSSVariablesEnabled);
     RuntimeEnabledFeatures::setAuthorShadowDOMForAnyElementEnabled(m_originalAuthorShadowDOMForAnyElementEnabled);
     RuntimeEnabledFeatures::setExperimentalShadowDOMEnabled(m_originalExperimentalShadowDOMEnabled);
+    settings->setExperimentalWebSocketEnabled(m_originalExperimentalWebSocketEnabled);
     RuntimeEnabledFeatures::setStyleScopedEnabled(m_originalStyleScoped);
     settings->setEditingBehaviorType(m_originalEditingBehavior);
     settings->setTextAutosizingEnabled(m_originalTextAutosizingEnabled);
     settings->setTextAutosizingWindowSizeOverride(m_originalTextAutosizingWindowSizeOverride);
     settings->setTextAutosizingFontScaleFactor(m_originalTextAutosizingFontScaleFactor);
-    settings->setResolutionOverride(m_originalResolutionOverride);
     settings->setMediaTypeOverride(m_originalMediaTypeOverride);
     RuntimeEnabledFeatures::setDialogElementEnabled(m_originalDialogElementEnabled);
     RuntimeEnabledFeatures::setLazyLayoutEnabled(m_originalLazyLayoutEnabled);
@@ -186,6 +186,11 @@
     RuntimeEnabledFeatures::setExperimentalShadowDOMEnabled(isEnabled);
 }
 
+void InternalSettings::setExperimentalWebSocketEnabled(bool isEnabled)
+{
+    settings()->setExperimentalWebSocketEnabled(isEnabled);
+}
+
 void InternalSettings::setStyleScopedEnabled(bool enabled)
 {
     RuntimeEnabledFeatures::setStyleScopedEnabled(enabled);
@@ -259,13 +264,6 @@
     settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height));
 }
 
-void InternalSettings::setResolutionOverride(int dotsPerCSSInchHorizontally, int dotsPerCSSInchVertically, ExceptionCode& ec)
-{
-    InternalSettingsGuardForSettings();
-    // An empty size resets the override.
-    settings()->setResolutionOverride(IntSize(dotsPerCSSInchHorizontally, dotsPerCSSInchVertically));
-}
-
 void InternalSettings::setMediaTypeOverride(const String& mediaType, ExceptionCode& ec)
 {
     InternalSettingsGuardForSettings();
diff --git a/Source/core/testing/InternalSettings.h b/Source/core/testing/InternalSettings.h
index 5bb84ab..29b4450 100644
--- a/Source/core/testing/InternalSettings.h
+++ b/Source/core/testing/InternalSettings.h
@@ -30,9 +30,9 @@
 #include "InternalSettingsGenerated.h"
 #include "core/editing/EditingBehaviorTypes.h"
 #include "core/platform/graphics/IntSize.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -54,12 +54,12 @@
         bool m_originalCSSVariablesEnabled;
         bool m_originalAuthorShadowDOMForAnyElementEnabled;
         bool m_originalExperimentalShadowDOMEnabled;
+        bool m_originalExperimentalWebSocketEnabled;
         bool m_originalStyleScoped;
         EditingBehaviorType m_originalEditingBehavior;
         bool m_originalTextAutosizingEnabled;
         IntSize m_originalTextAutosizingWindowSizeOverride;
         float m_originalTextAutosizingFontScaleFactor;
-        IntSize m_originalResolutionOverride;
         String m_originalMediaTypeOverride;
         bool m_originalDialogElementEnabled;
         bool m_originalLazyLayoutEnabled;
@@ -96,7 +96,6 @@
     void setImagesEnabled(bool, ExceptionCode&);
     void setMediaTypeOverride(const String& mediaType, ExceptionCode&);
     void setMockScrollbarsEnabled(bool, ExceptionCode&);
-    void setResolutionOverride(int dotsPerCSSInchHorizontally, int dotsPerCSSInchVertically, ExceptionCode&);
     void setTextAutosizingEnabled(bool, ExceptionCode&);
     void setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode&);
     void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode&);
@@ -111,12 +110,13 @@
     void setCSSVariablesEnabled(bool, ExceptionCode&);
 
     // FIXME: The following are RuntimeEnabledFeatures and likely
-    // cannot be changed after process start.  These setters should
+    // cannot be changed after process start. These setters should
     // be removed or moved onto internals.runtimeFlags:
     void setAuthorShadowDOMForAnyElementEnabled(bool);
     void setCSSExclusionsEnabled(bool);
     void setDialogElementEnabled(bool);
     void setExperimentalShadowDOMEnabled(bool);
+    void setExperimentalWebSocketEnabled(bool);
     void setLangAttributeAwareFormControlUIEnabled(bool);
     void setLazyLayoutEnabled(bool);
     void setStyleScopedEnabled(bool);
diff --git a/Source/core/testing/InternalSettings.idl b/Source/core/testing/InternalSettings.idl
index 30c0d91..ed5ad0e 100644
--- a/Source/core/testing/InternalSettings.idl
+++ b/Source/core/testing/InternalSettings.idl
@@ -39,7 +39,6 @@
     [RaisesException] void setTextAutosizingEnabled(boolean enabled);
     [RaisesException] void setTextAutosizingWindowSizeOverride(long width, long height);
     [RaisesException] void setTextAutosizingFontScaleFactor(float fontScaleFactor);
-    [RaisesException] void setResolutionOverride(long dotsPerCSSInchHorizontally, long dotsPerCSSInchVertically);
     [RaisesException] void setMediaTypeOverride(DOMString mediaTypeOverride);
     [RaisesException] void setEditingBehavior(DOMString behavior);
 
@@ -60,6 +59,7 @@
     void setCSSExclusionsEnabled(boolean enabled);
     void setDialogElementEnabled(boolean enabled);
     void setExperimentalShadowDOMEnabled(boolean enabled);
+    void setExperimentalWebSocketEnabled(boolean enabled);
     void setLangAttributeAwareFormControlUIEnabled(boolean enabled);
     void setLazyLayoutEnabled(boolean enabled);
     void setStyleScopedEnabled(boolean enabled);
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 111e1ff..1042d35 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -39,21 +39,23 @@
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/ClientRect.h"
 #include "core/dom/ClientRectList.h"
-#include "core/dom/ComposedShadowTreeWalker.h"
 #include "core/dom/DOMStringList.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentMarker.h"
 #include "core/dom/DocumentMarkerController.h"
 #include "core/dom/Element.h"
-#include "core/dom/ElementShadow.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/PseudoElement.h"
 #include "core/dom/Range.h"
-#include "core/dom/ShadowRoot.h"
 #include "core/dom/StaticNodeList.h"
 #include "core/dom/TreeScope.h"
 #include "core/dom/ViewportArguments.h"
+#include "core/dom/shadow/ComposedShadowTreeWalker.h"
+#include "core/dom/shadow/ContentDistributor.h"
+#include "core/dom/shadow/ElementShadow.h"
+#include "core/dom/shadow/SelectRuleFeatureSet.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/SpellChecker.h"
 #include "core/editing/TextIterator.h"
@@ -64,9 +66,7 @@
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/HTMLSelectElement.h"
 #include "core/html/HTMLTextAreaElement.h"
-#include "core/html/shadow/ContentDistributor.h"
 #include "core/html/shadow/HTMLContentElement.h"
-#include "core/html/shadow/SelectRuleFeatureSet.h"
 #include "core/inspector/InspectorClient.h"
 #include "core/inspector/InspectorConsoleAgent.h"
 #include "core/inspector/InspectorController.h"
@@ -98,7 +98,7 @@
 #include "core/rendering/RenderTreeAsText.h"
 #include "core/rendering/RenderView.h"
 #include "core/workers/WorkerThread.h"
-#include "origin/SchemeRegistry.h"
+#include "weborigin/SchemeRegistry.h"
 #include "wtf/dtoa.h"
 #include "wtf/text/StringBuffer.h"
 
@@ -170,20 +170,6 @@
         result =  DocumentMarker::Grammar;
     else if (equalIgnoringCase(markerType, "TextMatch"))
         result =  DocumentMarker::TextMatch;
-    else if (equalIgnoringCase(markerType, "Replacement"))
-        result =  DocumentMarker::Replacement;
-    else if (equalIgnoringCase(markerType, "CorrectionIndicator"))
-        result =  DocumentMarker::CorrectionIndicator;
-    else if (equalIgnoringCase(markerType, "RejectedCorrection"))
-        result =  DocumentMarker::RejectedCorrection;
-    else if (equalIgnoringCase(markerType, "Autocorrected"))
-        result =  DocumentMarker::Autocorrected;
-    else if (equalIgnoringCase(markerType, "SpellCheckingExemption"))
-        result =  DocumentMarker::SpellCheckingExemption;
-    else if (equalIgnoringCase(markerType, "DeletedAutocorrection"))
-        result =  DocumentMarker::DeletedAutocorrection;
-    else if (equalIgnoringCase(markerType, "DictationAlternatives"))
-        result =  DocumentMarker::DictationAlternatives;
     else
         return false;
 
@@ -213,6 +199,7 @@
 {
     ASSERT(page);
 
+    page->setDeviceScaleFactor(1);
     page->setPageScaleFactor(1, IntPoint(0, 0));
     page->setPagination(Pagination());
     TextRun::setAllowsRoundingHacks(false);
@@ -1356,14 +1343,6 @@
     return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
 }
 
-bool Internals::hasAutocorrectedMarker(Document* document, int from, int length, ExceptionCode&)
-{
-    if (!document || !document->frame())
-        return 0;
-
-    return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Autocorrected, from, length);
-}
-
 void Internals::setContinuousSpellCheckingEnabled(bool enabled, ExceptionCode&)
 {
     if (!contextDocument() || !contextDocument()->frame() || !contextDocument()->frame()->editor())
@@ -1711,6 +1690,17 @@
     return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
 }
 
+void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionCode& ec)
+{
+    Document* document = contextDocument();
+    if (!document || !document->page()) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+    Page* page = document->page();
+    page->setDeviceScaleFactor(scaleFactor);
+}
+
 void Internals::setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode& ec)
 {
     Document* document = contextDocument();
diff --git a/Source/core/testing/Internals.h b/Source/core/testing/Internals.h
index 783387d..7868899 100644
--- a/Source/core/testing/Internals.h
+++ b/Source/core/testing/Internals.h
@@ -187,7 +187,6 @@
 
     bool hasSpellingMarker(Document*, int from, int length, ExceptionCode&);
     bool hasGrammarMarker(Document*, int from, int length, ExceptionCode&);
-    bool hasAutocorrectedMarker(Document*, int from, int length, ExceptionCode&);
     void setContinuousSpellCheckingEnabled(bool enabled, ExceptionCode&);
 
     bool isOverwriteModeEnabled(Document*, ExceptionCode&);
@@ -250,6 +249,7 @@
     String pageProperty(String, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
     String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
 
+    void setDeviceScaleFactor(float scaleFactor, ExceptionCode&);
     void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&);
 
     void setIsCursorVisible(Document*, bool, ExceptionCode&);
diff --git a/Source/core/testing/Internals.idl b/Source/core/testing/Internals.idl
index fe7eec9..61620a7 100644
--- a/Source/core/testing/Internals.idl
+++ b/Source/core/testing/Internals.idl
@@ -148,7 +148,6 @@
 
     [RaisesException] boolean hasSpellingMarker(Document document, long from, long length);
     [RaisesException] boolean hasGrammarMarker(Document document, long from, long length);
-    [RaisesException] boolean hasAutocorrectedMarker(Document document, long from, long length);
     [RaisesException] void setContinuousSpellCheckingEnabled(boolean enabled);
 
     [RaisesException] boolean isOverwriteModeEnabled(Document document);
@@ -205,6 +204,7 @@
     [RaisesException] DOMString pageProperty(DOMString propertyName, long pageNumber);
     [RaisesException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft);
 
+    [RaisesException] void setDeviceScaleFactor(float scaleFactor);
     [RaisesException] void setPageScaleFactor(float scaleFactor, long x, long y);
 
     [RaisesException] void setIsCursorVisible(Document document, boolean isVisible);
@@ -241,7 +241,7 @@
 
     [Conditional=ENCRYPTED_MEDIA_V2] void initializeMockCDM();
 
-    [Conditional=SPEECH_SYNTHESIS] void enableMockSpeechSynthesizer();
+    void enableMockSpeechSynthesizer();
 
     [RaisesException] DOMString getImageSourceURL(Element element);
 
diff --git a/Source/core/tests/CachedImageTest.cpp b/Source/core/tests/CachedImageTest.cpp
index 8402754..1468726 100644
--- a/Source/core/tests/CachedImageTest.cpp
+++ b/Source/core/tests/CachedImageTest.cpp
@@ -34,6 +34,7 @@
 #include "core/loader/cache/CachedImageClient.h"
 #include "core/loader/cache/CachedResourceHandle.h"
 #include "core/platform/SharedBuffer.h"
+#include "core/platform/graphics/Image.h"
 #include <gtest/gtest.h>
 
 using namespace WebCore;
diff --git a/Source/core/workers/AbstractWorker.cpp b/Source/core/workers/AbstractWorker.cpp
index 80b317c..e14d7fa 100644
--- a/Source/core/workers/AbstractWorker.cpp
+++ b/Source/core/workers/AbstractWorker.cpp
@@ -40,13 +40,14 @@
 #include "core/dom/ScriptExecutionContext.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/ContentSecurityPolicy.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
 AbstractWorker::AbstractWorker(ScriptExecutionContext* context)
     : ActiveDOMObject(context)
 {
+    ScriptWrappable::init(this);
 }
 
 AbstractWorker::~AbstractWorker()
diff --git a/Source/core/workers/AbstractWorker.h b/Source/core/workers/AbstractWorker.h
index 8b4db37..e73baf2 100644
--- a/Source/core/workers/AbstractWorker.h
+++ b/Source/core/workers/AbstractWorker.h
@@ -31,6 +31,7 @@
 #ifndef AbstractWorker_h
 #define AbstractWorker_h
 
+#include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/ActiveDOMObject.h"
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
@@ -45,7 +46,7 @@
     class KURL;
     class ScriptExecutionContext;
 
-    class AbstractWorker : public RefCounted<AbstractWorker>, public ActiveDOMObject, public EventTarget {
+    class AbstractWorker : public RefCounted<AbstractWorker>, public ScriptWrappable, public ActiveDOMObject, public EventTarget {
     public:
         // EventTarget APIs
         virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { return ActiveDOMObject::scriptExecutionContext(); }
diff --git a/Source/core/workers/DedicatedWorkerContext.cpp b/Source/core/workers/DedicatedWorkerContext.cpp
index 84363bc..357dfd4 100644
--- a/Source/core/workers/DedicatedWorkerContext.cpp
+++ b/Source/core/workers/DedicatedWorkerContext.cpp
@@ -49,6 +49,7 @@
 DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin)
     : WorkerContext(url, userAgent, settings, thread, topOrigin)
 {
+    ScriptWrappable::init(this);
 }
 
 DedicatedWorkerContext::~DedicatedWorkerContext()
diff --git a/Source/core/workers/SharedWorker.cpp b/Source/core/workers/SharedWorker.cpp
index ff7eb8f..7672fbe 100644
--- a/Source/core/workers/SharedWorker.cpp
+++ b/Source/core/workers/SharedWorker.cpp
@@ -41,13 +41,14 @@
 #include "core/page/UseCounter.h"
 #include "core/platform/KURL.h"
 #include "core/workers/SharedWorkerRepository.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
 inline SharedWorker::SharedWorker(ScriptExecutionContext* context)
     : AbstractWorker(context)
 {
+    ScriptWrappable::init(this);
 }
 
 PassRefPtr<SharedWorker> SharedWorker::create(ScriptExecutionContext* context, const String& url, const String& name, ExceptionCode& ec)
diff --git a/Source/core/workers/SharedWorkerContext.cpp b/Source/core/workers/SharedWorkerContext.cpp
index 2765d2b..7745047 100644
--- a/Source/core/workers/SharedWorkerContext.cpp
+++ b/Source/core/workers/SharedWorkerContext.cpp
@@ -60,6 +60,7 @@
     : WorkerContext(url, userAgent, settings, thread, 0)
     , m_name(name)
 {
+    ScriptWrappable::init(this);
 }
 
 SharedWorkerContext::~SharedWorkerContext()
diff --git a/Source/core/workers/Worker.cpp b/Source/core/workers/Worker.cpp
index 66459c3..bd9a1a5 100644
--- a/Source/core/workers/Worker.cpp
+++ b/Source/core/workers/Worker.cpp
@@ -52,6 +52,7 @@
     : AbstractWorker(context)
     , m_contextProxy(WorkerContextProxy::create(this))
 {
+    ScriptWrappable::init(this);
 }
 
 PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String& url, ExceptionCode& ec)
diff --git a/Source/core/workers/WorkerContext.cpp b/Source/core/workers/WorkerContext.cpp
index 897d0bf..81bcb91 100644
--- a/Source/core/workers/WorkerContext.cpp
+++ b/Source/core/workers/WorkerContext.cpp
@@ -54,7 +54,7 @@
 #include "core/workers/WorkerObjectProxy.h"
 #include "core/workers/WorkerScriptLoader.h"
 #include "core/workers/WorkerThread.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
 #include "modules/notifications/NotificationCenter.h"
@@ -93,6 +93,7 @@
     , m_eventQueue(WorkerEventQueue::create(this))
     , m_topOrigin(topOrigin)
 {
+    ScriptWrappable::init(this);
     setSecurityOrigin(SecurityOrigin::create(url));
 }
 
diff --git a/Source/core/workers/WorkerContext.h b/Source/core/workers/WorkerContext.h
index 4fda4c2..febfca0 100644
--- a/Source/core/workers/WorkerContext.h
+++ b/Source/core/workers/WorkerContext.h
@@ -27,6 +27,7 @@
 #ifndef WorkerContext_h
 #define WorkerContext_h
 
+#include "bindings/v8/ScriptWrappable.h"
 #include "bindings/v8/WorkerScriptController.h"
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
@@ -53,7 +54,7 @@
     class WorkerNavigator;
     class WorkerThread;
 
-    class WorkerContext : public RefCounted<WorkerContext>, public ScriptExecutionContext, public EventTarget {
+    class WorkerContext : public RefCounted<WorkerContext>, public ScriptWrappable, public ScriptExecutionContext, public EventTarget {
     public:
         virtual ~WorkerContext();
 
diff --git a/Source/core/workers/WorkerContext.idl b/Source/core/workers/WorkerContext.idl
index d3153da..188b285 100644
--- a/Source/core/workers/WorkerContext.idl
+++ b/Source/core/workers/WorkerContext.idl
@@ -69,8 +69,8 @@
     attribute FileReaderConstructor FileReader;
     attribute FileReaderSyncConstructor FileReaderSync;
 
-    attribute DOMURLConstructor URL;
-    attribute DOMURLConstructor webkitURL; // FIXME: deprecate this.
+    attribute URLConstructor URL;
+    attribute URLConstructor webkitURL; // FIXME: deprecate this.
 
     attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator
     attribute Int8ArrayConstructor Int8Array; // Usable with new operator
diff --git a/Source/core/workers/WorkerLocation.h b/Source/core/workers/WorkerLocation.h
index c3a3c78..e21a11a 100644
--- a/Source/core/workers/WorkerLocation.h
+++ b/Source/core/workers/WorkerLocation.h
@@ -27,6 +27,7 @@
 #ifndef WorkerLocation_h
 #define WorkerLocation_h
 
+#include "bindings/v8/ScriptWrappable.h"
 #include "core/platform/KURL.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -35,33 +36,36 @@
 
 namespace WebCore {
 
-    class WorkerLocation : public RefCounted<WorkerLocation> {
-    public:
-        static PassRefPtr<WorkerLocation> create(const KURL& url)
-        {
-            return adoptRef(new WorkerLocation(url));
-        }
+class WorkerLocation : public RefCounted<WorkerLocation>, public ScriptWrappable {
+public:
+    static PassRefPtr<WorkerLocation> create(const KURL& url)
+    {
+        return adoptRef(new WorkerLocation(url));
+    }
 
-        const KURL& url() const { return m_url; }
+    const KURL& url() const { return m_url; }
 
-        String href() const;
+    String href() const;
 
-        // URI decomposition attributes
-        String protocol() const;
-        String host() const;
-        String hostname() const;
-        String port() const;
-        String pathname() const;
-        String search() const;
-        String hash() const;
+    // URI decomposition attributes
+    String protocol() const;
+    String host() const;
+    String hostname() const;
+    String port() const;
+    String pathname() const;
+    String search() const;
+    String hash() const;
 
-        String toString() const { return href(); }
+    String toString() const { return href(); }
 
-    private:
-        explicit WorkerLocation(const KURL& url) : m_url(url) { }
+private:
+    explicit WorkerLocation(const KURL& url) : m_url(url)
+    {
+        ScriptWrappable::init(this);
+    }
 
-        KURL m_url;
-    };
+    KURL m_url;
+};
 
 } // namespace WebCore
 
diff --git a/Source/core/workers/WorkerScriptLoader.cpp b/Source/core/workers/WorkerScriptLoader.cpp
index ab50e33..03361ea 100644
--- a/Source/core/workers/WorkerScriptLoader.cpp
+++ b/Source/core/workers/WorkerScriptLoader.cpp
@@ -36,7 +36,7 @@
 #include "core/platform/network/ResourceResponse.h"
 #include "core/workers/WorkerContext.h"
 #include "core/workers/WorkerScriptLoaderClient.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
@@ -71,6 +71,8 @@
     options.allowCredentials = AllowStoredCredentials;
     options.crossOriginRequestPolicy = crossOriginRequestPolicy;
     options.sendLoadCallbacks = SendCallbacks;
+    // FIXME: Should we add EnforceScriptSrcDirective here?
+    options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy;
 
     WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(scriptExecutionContext), *request, *this, options);
 }
diff --git a/Source/core/workers/WorkerThread.h b/Source/core/workers/WorkerThread.h
index 61e315a..3a03651 100644
--- a/Source/core/workers/WorkerThread.h
+++ b/Source/core/workers/WorkerThread.h
@@ -29,8 +29,8 @@
 
 #include "core/page/ContentSecurityPolicy.h"
 #include "core/page/GroupSettings.h"
-#include "origin/SecurityOrigin.h"
 #include "core/workers/WorkerRunLoop.h"
+#include "weborigin/SecurityOrigin.h"
 #include <wtf/Forward.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index d173c52..6e1db12 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -62,7 +62,7 @@
 #include "core/platform/network/ResourceRequest.h"
 #include "core/xml/XMLHttpRequestProgressEvent.h"
 #include "core/xml/XMLHttpRequestUpload.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
@@ -204,7 +204,7 @@
 Document* XMLHttpRequest::document() const
 {
     ASSERT(scriptExecutionContext()->isDocument());
-    return static_cast<Document*>(scriptExecutionContext());
+    return toDocument(scriptExecutionContext());
 }
 
 SecurityOrigin* XMLHttpRequest::securityOrigin() const
@@ -477,14 +477,7 @@
         return;
     }
 
-    // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
-    bool shouldBypassMainWorldContentSecurityPolicy = false;
-    if (scriptExecutionContext()->isDocument()) {
-        Document* document = static_cast<Document*>(scriptExecutionContext());
-        if (document->frame())
-            shouldBypassMainWorldContentSecurityPolicy = document->frame()->script()->shouldBypassMainWorldContentSecurityPolicy();
-    }
-    if (!shouldBypassMainWorldContentSecurityPolicy && !scriptExecutionContext()->contentSecurityPolicy()->allowConnectToSource(url)) {
+    if (!ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) && !scriptExecutionContext()->contentSecurityPolicy()->allowConnectToSource(url)) {
         // FIXME: Should this be throwing an exception?
         ec = SECURITY_ERR;
         return;
@@ -749,9 +742,11 @@
     options.sniffContent = DoNotSniffContent;
     options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight;
     options.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+    options.credentialsRequested = m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials;
     options.crossOriginRequestPolicy = UseAccessControl;
     options.securityOrigin = securityOrigin();
     options.initiator = cachedResourceRequestInitiators().xmlhttprequest;
+    options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
 
 #if ENABLE(XHR_TIMEOUT)
     if (m_timeoutMilliseconds)
diff --git a/Source/core/xml/XMLHttpRequest.h b/Source/core/xml/XMLHttpRequest.h
index eb77257..0d7a053 100644
--- a/Source/core/xml/XMLHttpRequest.h
+++ b/Source/core/xml/XMLHttpRequest.h
@@ -28,10 +28,10 @@
 #include "core/dom/EventNames.h"
 #include "core/dom/EventTarget.h"
 #include "core/loader/ThreadableLoaderClient.h"
-#include "origin/SecurityOrigin.h"
 #include "core/platform/network/FormData.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "core/xml/XMLHttpRequestProgressEventThrottle.h"
+#include "weborigin/SecurityOrigin.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/text/AtomicStringHash.h>
 #include <wtf/text/StringBuilder.h>
diff --git a/Source/core/xml/XSLTProcessor.cpp b/Source/core/xml/XSLTProcessor.cpp
index 7e958d3..0484914 100644
--- a/Source/core/xml/XSLTProcessor.cpp
+++ b/Source/core/xml/XSLTProcessor.cpp
@@ -37,7 +37,7 @@
 #include "core/page/Frame.h"
 #include "core/page/FrameView.h"
 #include "core/page/Page.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #include <wtf/Assertions.h>
 #include <wtf/Vector.h>
diff --git a/Source/core/xml/XSLTProcessorLibxslt.cpp b/Source/core/xml/XSLTProcessorLibxslt.cpp
index 5adad8b..961c0ef 100644
--- a/Source/core/xml/XSLTProcessorLibxslt.cpp
+++ b/Source/core/xml/XSLTProcessorLibxslt.cpp
@@ -48,7 +48,7 @@
 #include "core/xml/XSLTExtensions.h"
 #include "core/xml/XSLTUnicodeSort.h"
 #include "core/xml/parser/XMLDocumentParser.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/core/xml/parser/XMLDocumentParser.cpp b/Source/core/xml/parser/XMLDocumentParser.cpp
index 93ca28c..4e8e17e 100644
--- a/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -67,7 +67,7 @@
 #include "core/xml/XMLErrors.h"
 #include "core/xml/XMLTreeViewer.h"
 #include "core/xml/parser/XMLDocumentParserScope.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 #if ENABLE(SVG)
 #include "SVGNames.h"